@@ -906,8 +906,8 @@ pub fn discover_account(
906
906
Ok ( false )
907
907
}
908
908
909
- /// Populate `derivation_path` and `scriptpubkey` in `UnspentOutput ` by looking in our internal
910
- /// cache by provided `subaccount`, `txid` and `pt_idx` (vout) and return an error if not present.
909
+ /// Populate `derivation_path` and `scriptpubkey` in `utxos ` by looking in our internal
910
+ /// cache by provided `txhash` and `pt_idx` and return an error if not present.
911
911
/// This allows to have this data if missing, but also avoid trusting the user input for this fields.
912
912
pub fn populate_unspent_from_db (
913
913
account : & Account ,
@@ -916,7 +916,7 @@ pub fn populate_unspent_from_db(
916
916
let store = account. store . read ( ) ?;
917
917
918
918
for u in request. utxos . 0 . values_mut ( ) . flat_map ( |e| e. iter_mut ( ) ) {
919
- let cache = store. account_cache ( u . subaccount ) ?;
919
+ let cache = store. account_cache ( account . account_num ) ?;
920
920
let txid = BETxid :: from_hex ( & u. txhash , account. network . id ( ) ) ?;
921
921
let tx_entry = cache. all_txs . get ( & txid) . ok_or_else ( || Error :: TxNotFound ( txid) ) ?;
922
922
let tx = & tx_entry. tx ;
@@ -937,7 +937,7 @@ pub fn create_tx(
937
937
account : & Account ,
938
938
request : & mut CreateTransaction ,
939
939
) -> Result < TransactionMeta , Error > {
940
- let _ = populate_unspent_from_db ( account, request) ; // FIXME: throw error if cannot be populated
940
+ populate_unspent_from_db ( account, request) ? ;
941
941
info ! ( "create_tx {:?}" , request) ;
942
942
943
943
let network = & account. network ;
0 commit comments