接上文,在这个函数中
func (sm *SyncManager) handleTxMsg(tmsg *txMsg)

调用txMemPool成员函数ProcessTransaction对tx进行校验。在syncmanager对象中,txMemPool,顾名思义就是交易池。负责对交易的验证和管理。
    
tx的数据结构如下:
// Tx defines a bitcoin transaction that provides easier and more efficient
// manipulation of raw transactions.  It also memoizes the hash for the
// transaction on its first access so subsequent accesses don‘t have to repeat
// the relatively expensive hashing operations.
type Tx struct {
	msgTx         *wire.MsgTx     // Underlying MsgTx
	txHash        *chainhash.Hash // Cached transaction hash
	txHashWitness *chainhash.Hash // Cached transaction witness hash
	txHasWitness  *bool           // If the transaction has witness data
	txIndex       int             // Position within a block or TxIndexUnknown
}
在ProcessTransaction函数中调用了maybeAcceptTransaction,其中CheckTransactionSanity,主要对交易的输入个数和及交易的序列化大小、交易输入的前向节点,交易输出的比特币大小进行验证

原文:https://www.cnblogs.com/xgcode/p/9126915.html