From a6aae35b62c6a520a484496ca9a3a286407962cb Mon Sep 17 00:00:00 2001 From: Jonathan Downing Date: Tue, 4 Feb 2025 22:51:05 -0600 Subject: [PATCH] Bugfix: Allow automatic coinbase redemptions with hash in data field --- core/state_processor.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/core/state_processor.go b/core/state_processor.go index 56f56a03b1..e632f6ce22 100644 --- a/core/state_processor.go +++ b/core/state_processor.go @@ -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 { @@ -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 } }