btcjson: Add more fields to ListTransactionsResult

These include Abandoned, BIP125Replaceable, and Trusted.
This commit is contained in:
David Hill 2017-01-23 15:03:54 -05:00
parent 07f8c84fb1
commit e8b9147ba2
2 changed files with 35 additions and 26 deletions

View File

@ -58,9 +58,11 @@ type InfoWalletResult struct {
// ListTransactionsResult models the data from the listtransactions command.
type ListTransactionsResult struct {
Abandoned bool `json:"abandoned"`
Account string `json:"account"`
Address string `json:"address,omitempty"`
Amount float64 `json:"amount"`
BIP125Replaceable string `json:"bip125-replaceable,omitempty"`
BlockHash string `json:"blockhash,omitempty"`
BlockIndex *int64 `json:"blockindex,omitempty"`
BlockTime int64 `json:"blocktime,omitempty"`
@ -71,6 +73,7 @@ type ListTransactionsResult struct {
InvolvesWatchOnly bool `json:"involveswatchonly,omitempty"`
Time int64 `json:"time"`
TimeReceived int64 `json:"timereceived"`
Trusted bool `json:"trusted"`
TxID string `json:"txid"`
Vout uint32 `json:"vout"`
WalletConflicts []string `json:"walletconflicts"`

View File

@ -72,41 +72,47 @@ func TestWalletSvrWsNtfns(t *testing.T) {
{
name: "newtx",
newNtfn: func() (interface{}, error) {
return btcjson.NewCmd("newtx", "acct", `{"account":"acct","address":"1Address","category":"send","amount":1.5,"fee":0.0001,"confirmations":1,"txid":"456","walletconflicts":[],"time":12345678,"timereceived":12345876,"vout":789,"otheraccount":"otheracct"}`)
return btcjson.NewCmd("newtx", "acct", `{"account":"acct","address":"1Address","category":"send","amount":1.5,"bip125-replaceable":"unknown","fee":0.0001,"confirmations":1,"trusted":true,"txid":"456","walletconflicts":[],"time":12345678,"timereceived":12345876,"vout":789,"otheraccount":"otheracct"}`)
},
staticNtfn: func() interface{} {
result := btcjson.ListTransactionsResult{
Account: "acct",
Address: "1Address",
Category: "send",
Amount: 1.5,
Fee: btcjson.Float64(0.0001),
Confirmations: 1,
TxID: "456",
WalletConflicts: []string{},
Time: 12345678,
TimeReceived: 12345876,
Vout: 789,
OtherAccount: "otheracct",
Abandoned: false,
Account: "acct",
Address: "1Address",
BIP125Replaceable: "unknown",
Category: "send",
Amount: 1.5,
Fee: btcjson.Float64(0.0001),
Confirmations: 1,
TxID: "456",
WalletConflicts: []string{},
Time: 12345678,
TimeReceived: 12345876,
Trusted: true,
Vout: 789,
OtherAccount: "otheracct",
}
return btcjson.NewNewTxNtfn("acct", result)
},
marshalled: `{"jsonrpc":"1.0","method":"newtx","params":["acct",{"account":"acct","address":"1Address","amount":1.5,"category":"send","confirmations":1,"fee":0.0001,"time":12345678,"timereceived":12345876,"txid":"456","vout":789,"walletconflicts":[],"otheraccount":"otheracct"}],"id":null}`,
marshalled: `{"jsonrpc":"1.0","method":"newtx","params":["acct",{"abandoned":false,"account":"acct","address":"1Address","amount":1.5,"bip125-replaceable":"unknown","category":"send","confirmations":1,"fee":0.0001,"time":12345678,"timereceived":12345876,"trusted":true,"txid":"456","vout":789,"walletconflicts":[],"otheraccount":"otheracct"}],"id":null}`,
unmarshalled: &btcjson.NewTxNtfn{
Account: "acct",
Details: btcjson.ListTransactionsResult{
Account: "acct",
Address: "1Address",
Category: "send",
Amount: 1.5,
Fee: btcjson.Float64(0.0001),
Confirmations: 1,
TxID: "456",
WalletConflicts: []string{},
Time: 12345678,
TimeReceived: 12345876,
Vout: 789,
OtherAccount: "otheracct",
Abandoned: false,
Account: "acct",
Address: "1Address",
BIP125Replaceable: "unknown",
Category: "send",
Amount: 1.5,
Fee: btcjson.Float64(0.0001),
Confirmations: 1,
TxID: "456",
WalletConflicts: []string{},
Time: 12345678,
TimeReceived: 12345876,
Trusted: true,
Vout: 789,
OtherAccount: "otheracct",
},
},
},