@@ -45,7 +45,28 @@ impl RpcApi for Client {
45
45
) -> bitcoincore_rpc:: Result < bitcoin:: Transaction > {
46
46
Ok ( self . ledger . get_transaction ( * txid) )
47
47
}
48
-
48
+ fn get_raw_transaction_info (
49
+ & self ,
50
+ txid : & bitcoin:: Txid ,
51
+ _block_hash : Option < & bitcoin:: BlockHash > ,
52
+ ) -> bitcoincore_rpc:: Result < json:: GetRawTransactionResult > {
53
+ Ok ( GetRawTransactionResult {
54
+ in_active_chain : None ,
55
+ hex : vec ! [ ] ,
56
+ txid : * txid,
57
+ hash : Wtxid :: hash ( & [ 0 ] ) ,
58
+ size : 0 ,
59
+ vsize : 0 ,
60
+ version : 0 ,
61
+ locktime : 0 ,
62
+ vin : vec ! [ ] ,
63
+ vout : vec ! [ ] ,
64
+ blockhash : None ,
65
+ confirmations : Some ( 10 ) ,
66
+ time : None ,
67
+ blocktime : None ,
68
+ } )
69
+ }
49
70
fn send_raw_transaction < R : bitcoincore_rpc:: RawTx > (
50
71
& self ,
51
72
tx : R ,
@@ -57,34 +78,6 @@ impl RpcApi for Client {
57
78
Ok ( tx. compute_txid ( ) )
58
79
}
59
80
60
- fn send_to_address (
61
- & self ,
62
- address : & Address < NetworkChecked > ,
63
- amount : Amount ,
64
- _comment : Option < & str > ,
65
- _comment_to : Option < & str > ,
66
- _subtract_fee : Option < bool > ,
67
- _replaceable : Option < bool > ,
68
- _confirmation_target : Option < u32 > ,
69
- _estimate_mode : Option < json:: EstimateMode > ,
70
- ) -> bitcoincore_rpc:: Result < bitcoin:: Txid > {
71
- let txin = TxIn :: default ( ) ;
72
- let txout = TxOut {
73
- value : amount,
74
- script_pubkey : address. script_pubkey ( ) ,
75
- } ;
76
- let tx = bitcoin:: Transaction {
77
- version : bitcoin:: transaction:: Version ( 2 ) ,
78
- lock_time : absolute:: LockTime :: from_consensus ( 0 ) ,
79
- input : vec ! [ txin] ,
80
- output : vec ! [ txout] ,
81
- } ;
82
-
83
- let txid = self . send_raw_transaction ( & tx) ?;
84
-
85
- Ok ( txid)
86
- }
87
-
88
81
fn get_transaction (
89
82
& self ,
90
83
txid : & bitcoin:: Txid ,
@@ -122,6 +115,36 @@ impl RpcApi for Client {
122
115
Ok ( res)
123
116
}
124
117
118
+ fn send_to_address (
119
+ & self ,
120
+ address : & Address < NetworkChecked > ,
121
+ amount : Amount ,
122
+ _comment : Option < & str > ,
123
+ _comment_to : Option < & str > ,
124
+ _subtract_fee : Option < bool > ,
125
+ _replaceable : Option < bool > ,
126
+ _confirmation_target : Option < u32 > ,
127
+ _estimate_mode : Option < json:: EstimateMode > ,
128
+ ) -> bitcoincore_rpc:: Result < bitcoin:: Txid > {
129
+ let txin = TxIn :: default ( ) ;
130
+ let txout = TxOut {
131
+ value : amount,
132
+ script_pubkey : address. script_pubkey ( ) ,
133
+ } ;
134
+ let tx = bitcoin:: Transaction {
135
+ version : bitcoin:: transaction:: Version ( 2 ) ,
136
+ lock_time : absolute:: LockTime :: from_consensus ( 0 ) ,
137
+ input : vec ! [ txin] ,
138
+ output : vec ! [ txout] ,
139
+ } ;
140
+
141
+ let txid = self . send_raw_transaction ( & tx) ?;
142
+
143
+ self . ledger . add_transaction_unconditionally ( tx) ;
144
+
145
+ Ok ( txid)
146
+ }
147
+
125
148
fn get_new_address (
126
149
& self ,
127
150
_label : Option < & str > ,
@@ -141,29 +164,6 @@ impl RpcApi for Client {
141
164
Ok ( address)
142
165
}
143
166
144
- fn get_raw_transaction_info (
145
- & self ,
146
- txid : & bitcoin:: Txid ,
147
- _block_hash : Option < & bitcoin:: BlockHash > ,
148
- ) -> bitcoincore_rpc:: Result < json:: GetRawTransactionResult > {
149
- Ok ( GetRawTransactionResult {
150
- in_active_chain : None ,
151
- hex : vec ! [ ] ,
152
- txid : * txid,
153
- hash : Wtxid :: hash ( & [ 0 ] ) ,
154
- size : 0 ,
155
- vsize : 0 ,
156
- version : 0 ,
157
- locktime : 0 ,
158
- vin : vec ! [ ] ,
159
- vout : vec ! [ ] ,
160
- blockhash : None ,
161
- confirmations : Some ( 10 ) ,
162
- time : None ,
163
- blocktime : None ,
164
- } )
165
- }
166
-
167
167
/// Generates `block_num` amount of block rewards to user.
168
168
fn generate_to_address (
169
169
& self ,
0 commit comments