Bitcoin-Core

getbalance 表示傳入 TX 為 0,即使允許 0-conf

  • November 21, 2019
> $bitcoin_rpc.getnewaddress("myaddress", "bech32")
=> "bc1q9kvfyjxtk9tvkzgpkf4x8zs42sddwlyanz3z6z" 
> $bitcoin_rpc.getbalance
=> 0.0 
> $bitcoin_rpc.getbalance("*", 0)
=> 0.0 
> $bitcoin_rpc.listtransactions
=> [{"address"=>"bc1q9kvfyjxtk9tvkzgpkf4x8zs42sddwlyanz3z6z", "category"=>"receive", "amount"=>0.00025, "label"=>"myaddress", "vout"=>1, "confirmations"=>0, "trusted"=>false, "txid"=>"ad922349668c17c3ab47081f6dbc6e7e8f68473840146bfdd18f35f7d0bca216", "walletconflicts"=>[], "time"=>1574217056, "timereceived"=>1574217056, "bip125-replaceable"=>"yes"}] 
> Time.now.to_i
=> 1574217344 

它背後的魔力是什麼?由於confirmation=0是預設值,我希望返回值為 0.00025。

getbalance返回您的節點目前認為可花費的餘額。根據您的控制台輸出,向您發送輸出的交易被標記為"bip125-replaceable"=>"yes". 由於標記為可替換的交易可以由發送者修改或撤回,直到它得到確認,所以此類交易的輸出將不被認為是可靠的,並且在確認之前不會用作輸入。

引用自:https://bitcoin.stackexchange.com/questions/91796