wallet: allow SendOutputs to notify new outgoing transactions for neutrino
In this commit, we modify the SendOutputs method to also notify new outgoing transctions for neutriino. For the full node backends, they'll get this notification when the transactino hits the mempool. However, for neutrino it will only be notified once the transaction has been confirmed. This commit ensures that we'll notify on send as well.
This commit is contained in:
parent
8ae4afc701
commit
0cfe15c0c7
1 changed files with 20 additions and 1 deletions
|
@ -3132,7 +3132,26 @@ func (w *Wallet) SendOutputs(outputs []*wire.TxOut, account uint32,
|
||||||
|
|
||||||
// TODO: The record already has the serialized tx, so no need to
|
// TODO: The record already has the serialized tx, so no need to
|
||||||
// serialize it again.
|
// serialize it again.
|
||||||
return chainClient.SendRawTransaction(&rec.MsgTx, false)
|
txid, err := chainClient.SendRawTransaction(&rec.MsgTx, false)
|
||||||
|
switch {
|
||||||
|
case err == nil:
|
||||||
|
switch w.chainClient.(type) {
|
||||||
|
// For neutrino we need to trigger adding relevant tx manually
|
||||||
|
// because for spv client - tx data isn't received from sync peer.
|
||||||
|
case *chain.NeutrinoClient:
|
||||||
|
err := walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) error {
|
||||||
|
return w.addRelevantTx(tx, rec, nil)
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO(roasbeef): properly act on rest of mapped errors
|
||||||
|
return txid, nil
|
||||||
|
default:
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SignatureError records the underlying error when validating a transaction
|
// SignatureError records the underlying error when validating a transaction
|
||||||
|
|
Loading…
Reference in a new issue