Fix listtransactions category for coinbase outputs.
The category for a received coinbase output should be "generate" for a mature coinbase (one that has reached btcchain.CoinbaseMaturity confirmations), or "immature" if the required number of confirmations has not been reached yet. New Confirmed and Confirmations methods have been added to the transaction store's TxRecord type to check if the required number of confirmations have been met for coinbase outputs. While here, update the main package to use the new TxRecord methods, rather than duplicating the confirmation checking code in two places.
This commit is contained in:
parent
17ebf9461f
commit
e39fa32487
6 changed files with 42 additions and 36 deletions
|
@ -1057,7 +1057,7 @@ func GetTransaction(icmd btcjson.Cmd) (interface{}, *btcjson.Error) {
|
|||
ret.BlockIndex = int64(first.Tx.Tx().Index())
|
||||
ret.BlockHash = txBlock.Hash.String()
|
||||
ret.BlockTime = txBlock.Time.Unix()
|
||||
ret.Confirmations = int64(confirms(txr.BlockHeight, bs.Height))
|
||||
ret.Confirmations = int64(txr.Confirmations(bs.Height))
|
||||
}
|
||||
// TODO(oga) if the tx is a coinbase we should set "generated" to true.
|
||||
// Since we do not mine this currently is never the case.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue