Merge pull request #543 from Roasbeef/neutrino-ntfn

wallet: allow SendOutputs to notify new outgoing transactions for neu…
This commit is contained in:
Olaoluwa Osuntokun 2018-09-12 20:21:40 -07:00 committed by GitHub
commit 54a82426c8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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
// 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