From e8b9147ba2e219789f93ba21926eb2e96b979a15 Mon Sep 17 00:00:00 2001 From: David Hill Date: Mon, 23 Jan 2017 15:03:54 -0500 Subject: [PATCH] btcjson: Add more fields to ListTransactionsResult These include Abandoned, BIP125Replaceable, and Trusted. --- btcjson/walletsvrresults.go | 3 ++ btcjson/walletsvrwsntfns_test.go | 58 ++++++++++++++++++-------------- 2 files changed, 35 insertions(+), 26 deletions(-) diff --git a/btcjson/walletsvrresults.go b/btcjson/walletsvrresults.go index 2f7d80c6..9246d131 100644 --- a/btcjson/walletsvrresults.go +++ b/btcjson/walletsvrresults.go @@ -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"` diff --git a/btcjson/walletsvrwsntfns_test.go b/btcjson/walletsvrwsntfns_test.go index a1b267c5..7662b3c2 100644 --- a/btcjson/walletsvrwsntfns_test.go +++ b/btcjson/walletsvrwsntfns_test.go @@ -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", }, }, },