wallet: fix lost balance of unmined transaction for neutrino

This commit is contained in:
Vadym Popov 2018-07-08 11:46:25 +03:00
parent 74a7124666
commit 40ba75dd9d
No known key found for this signature in database
GPG key ID: 80A808D6A76EE753

View file

@ -3224,6 +3224,15 @@ func (w *Wallet) PublishTransaction(tx *wire.MsgTx) error {
_, err = server.SendRawTransaction(tx, false) _, err = server.SendRawTransaction(tx, false)
switch { switch {
case err == nil: 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:
return walletdb.Update(w.db, func(tx walletdb.ReadWriteTx) error {
return w.addRelevantTx(tx, txRec, nil)
})
}
return nil return nil
// The following are errors returned from btcd's mempool. // The following are errors returned from btcd's mempool.