Skip to content

Commit

Permalink
NullifyBurnAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonheaven committed Feb 17, 2021
1 parent 2daadb6 commit b5c7c99
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
2 changes: 2 additions & 0 deletions node/burns.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{}
)
Expand Down
24 changes: 19 additions & 5 deletions node/sync.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit b5c7c99

Please sign in to comment.