Transaction(TX) 的接收

in #bitcoin6 years ago

Transaction(TX) 的接收

  1. CTransaction::AcceptTransaction
  1. 返回值 bool

  2. 传入参数
    @txdb 本地数据库的TX存储
    @fCheckInputs 要不要对传入的Tx进行检查
    @pfMissingInputs 不知道干嘛的一个神奇指针

  3. 主要调用
    @IsCoinBase() 检查这个Tx是不是矿工奖励,是的话则没有输入
    @CheckTransaction() 粗略检查,保证这个Tx结构完整
    @IsNewerThan(*ptxOld) 比较哪个更新
    @ConnectInputs(txdb,mapUnused,CDiskTxPos(1,1,1),0,nFees,false,false) 完整检查,确认合法
    @AddToMemoryPool() 闭着眼睛放入内存池,补课单独调用

  4. 流程图

  1. CTransaction::IsCoinBase
    1)返回值 bool
    2)传入参数
    类的方法,直接使用类内属性
    3)主要调用

    4)流程图
    Return (vin.size() == 1 && vin[0].preout.IsNull());
  2. CTransaction::CheckTransaction
  1. 返回值 bool
  2. 传入参数
    类的方法,直接使用类内属性
  3. 主要调用
    @IsCoinBase() 是否为矿工挖矿奖励Tx
  4. 流程图
  1. CTransaction::IsNewerThan
  1. 返回值 bool
  2. 传入参数
    @old 在内存中找到的相似Tx
  3. 主要调用
  4. 流程图
  1. CTransaction::ConnectInputs
    1)返回值 bool
    2)传入参数
    @txdb 本地交易存储
    @mapTestPool 未打包进区块交易的内存池
    @posThisTx 这个Tx所在本地位置
    @nHeight Block的高度
    @nFees 矿工小费
    @fBlock 是不是一个区块
    @fMiner 是不是一个矿工
    @nMinFee 矿工最少小费
    3)主要调用
    @IsCoinBase()
    @VerifySignature()
    4)流程图

  2. CTransaction::AddToMemoryPool
    1)返回值 bool
    2)传入参数
    类内方法
    3)主要调用

    4)流程图
    把Tx存入mapTransaction,更新mapNextTx,++nTransactionUpdated

Sort:  

Congratulations @ksgting! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

You got a First Vote

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here

If you no longer want to receive notifications, reply to this comment with the word STOP

Upvote this notification to help all Steemit users. Learn why here!

Do not miss the last announcement from @steemitboard!

Coin Marketplace

STEEM 0.17
TRX 0.15
JST 0.028
BTC 60111.17
ETH 2322.86
USDT 1.00
SBD 2.53