OSDN Git Service

validation should handle the int/uint type convert
authorpaladz <453256728@qq.com>
Fri, 22 Sep 2017 05:27:09 +0000 (13:27 +0800)
committerpaladz <453256728@qq.com>
Fri, 22 Sep 2017 05:27:09 +0000 (13:27 +0800)
blockchain/reactor.go
protocol/validation/validation.go

index bf62ea6..26a83f0 100644 (file)
@@ -353,7 +353,7 @@ func (bcR *BlockchainReactor) Receive(chID byte, src *p2p.Peer, msgBytes []byte)
                if err != nil {
                        return
                }
-               bcR.txPool.AddTransaction(tx, block.BlockHeader.Height, uint64(gas))
+               bcR.txPool.AddTransaction(tx, block.BlockHeader.Height, gas)
                go bcR.BroadcastTransaction(tx)
        default:
                bcR.Logger.Error(cmn.Fmt("Unknown message type %v", reflect.TypeOf(msg)))
index 2db6627..b6efc6c 100644 (file)
@@ -535,7 +535,7 @@ func ValidateBlock(b, prev *bc.Block) error {
                if err != nil {
                        return errors.Wrapf(err, "validity of transaction %d of %d", i, len(b.Transactions))
                }
-               coinbaseValue += uint64(txBTMValue)
+               coinbaseValue += txBTMValue
        }
 
        // check the coinbase output entry value
@@ -579,7 +579,7 @@ func validateBlockAgainstPrev(b, prev *bc.Block) error {
 }
 
 // ValidateTx validates a transaction.
-func ValidateTx(tx *bc.Tx, block *bc.Block) (int64, error) {
+func ValidateTx(tx *bc.Tx, block *bc.Block) (uint64, error) {
        if tx.TxHeader.SerializedSize > maxTxSize {
                return 0, errWrongTransactionSize
        }
@@ -596,5 +596,5 @@ func ValidateTx(tx *bc.Tx, block *bc.Block) (int64, error) {
        }
 
        err := checkValid(vs, tx.TxHeader)
-       return vs.gas.BTMValue, err
+       return uint64(vs.gas.BTMValue), err
 }