From b5c7c99592082c4531a67ab6d4b72745622ff815 Mon Sep 17 00:00:00 2001 From: dragonheaven Date: Wed, 17 Feb 2021 18:22:23 +0100 Subject: [PATCH] NullifyBurnAddress --- node/burns.go | 2 ++ node/sync.go | 24 +++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/node/burns.go b/node/burns.go index c134d2a4..3f9a5eef 100644 --- a/node/burns.go +++ b/node/burns.go @@ -11,6 +11,8 @@ var ( // BurnAddress that can be used for all assets GlobalBurnAddress = "FA2BURNBABYBURNoooooooooooooooooooooooooooooooDGvNXy" + GlobalOldBurnAddress = "FA1y5ZGuHSLmf2TqNf6hVMkPiNGyQpQDTFJvDLRkKQaoPo4bmbgu" + // BurnRCD is the rcd representation of the burn address BurnRCD = [32]byte{} ) diff --git a/node/sync.go b/node/sync.go index b9a96691..cddb360d 100644 --- a/node/sync.go +++ b/node/sync.go @@ -94,6 +94,9 @@ OuterSyncLoop: // One time operation, Inserts negative balance for the burn address that used during the attack // We need to do this before main logic because sqlite db will be locked + if d.Sync.Synced+1 == V20DevRewardsHeightActivation { + d.NullifyBurnAddress(ctx, tx, d.Sync.Synced+1) + } if d.Sync.Synced+1 == V202EnhanceActivation { d.NullifyBurnAddress(ctx, tx, d.Sync.Synced+1) } @@ -172,11 +175,22 @@ OuterSyncLoop: func (d *Pegnetd) NullifyBurnAddress(ctx context.Context, tx *sql.Tx, height uint32) error { fLog := log.WithFields(log.Fields{"height": height}) - FAGlobalBurnAddress, err := factom.NewFAAddress(GlobalBurnAddress) - if err != nil { - log.WithFields(log.Fields{ - "error": err, - }).Info("error getting burn address") + var FAGlobalBurnAddress factom.FAAddress + var err error + if height < V202EnhanceActivation { + FAGlobalBurnAddress, err = factom.NewFAAddress(GlobalOldBurnAddress) + if err != nil { + log.WithFields(log.Fields{ + "error": err, + }).Info("error getting burn address") + } + } else { + FAGlobalBurnAddress, err = factom.NewFAAddress(GlobalBurnAddress) + if err != nil { + log.WithFields(log.Fields{ + "error": err, + }).Info("error getting burn address") + } } dblock := new(factom.DBlock)