Skip to content

Commit

Permalink
Bugfix: Allow automatic coinbase redemptions with hash in data field
Browse files Browse the repository at this point in the history
  • Loading branch information
jdowning100 authored and gameofpointers committed Feb 5, 2025
1 parent 9ded899 commit a6aae35
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions core/state_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1178,7 +1178,7 @@ func RedeemLockedQuai(hc *HeaderChain, header *types.WorkObject, parent *types.W
// Check if the transaction is a coinbase transaction
if types.IsCoinBaseTx(etx) && etx.To().IsInQuaiLedgerScope() {

if len(etx.Data()) == 1 {
if len(etx.Data()) == 1+common.HashLength {
// Redeem all unlocked Quai for the coinbase address
internal, err := etx.To().InternalAddress()
if err != nil {
Expand Down Expand Up @@ -1209,9 +1209,13 @@ func RedeemLockedQuai(hc *HeaderChain, header *types.WorkObject, parent *types.W
Amt: balance,
})
}
} else if len(etx.Data()) == common.AddressLength+1 || len(etx.Data()) == common.AddressLength+common.AddressLength+1 {
} else if len(etx.Data()) == 1+common.AddressLength+common.HashLength || len(etx.Data()) == 1+common.AddressLength+common.AddressLength+common.HashLength {
// This coinbase is owned by a smart contract and must be unlocked manually
continue
} else {
// Strange data length, log an error and skip
hc.logger.Errorf("Invalid data length for coinbase ETX %s: %d", etx.Hash().String(), len(etx.Data()))
continue
}
}

Expand Down

0 comments on commit a6aae35

Please sign in to comment.