mirror of
https://github.com/LBRYFoundation/lbcwallet.git
synced 2025-08-23 17:47:29 +00:00
Issue #65: Give the correct error when wallet is locked
When sending coins to an address with a wallet that's both locked and has insufficient funds, the correct ErrWalletLocked error will be returned.
This commit is contained in:
parent
c9ff0531f9
commit
e22d221ea8
2 changed files with 7 additions and 0 deletions
|
@ -140,6 +140,11 @@ func selectInputs(utxos []*tx.RecvTxOut, amt int64,
|
||||||
// block hash) Utxo. ErrInsufficientFunds is returned if there are not
|
// block hash) Utxo. ErrInsufficientFunds is returned if there are not
|
||||||
// enough eligible unspent outputs to create the transaction.
|
// enough eligible unspent outputs to create the transaction.
|
||||||
func (a *Account) txToPairs(pairs map[string]int64, minconf int) (*CreatedTx, error) {
|
func (a *Account) txToPairs(pairs map[string]int64, minconf int) (*CreatedTx, error) {
|
||||||
|
// Wallet must be unlocked to compose transaction.
|
||||||
|
if a.IsLocked() {
|
||||||
|
return nil, wallet.ErrWalletLocked
|
||||||
|
}
|
||||||
|
|
||||||
// Create a new transaction which will include all input scripts.
|
// Create a new transaction which will include all input scripts.
|
||||||
msgtx := btcwire.NewMsgTx()
|
msgtx := btcwire.NewMsgTx()
|
||||||
|
|
||||||
|
|
|
@ -1770,7 +1770,9 @@ func WalletPassphrase(icmd btcjson.Cmd) (interface{}, *btcjson.Error) {
|
||||||
|
|
||||||
go func(timeout int64) {
|
go func(timeout int64) {
|
||||||
time.Sleep(time.Second * time.Duration(timeout))
|
time.Sleep(time.Second * time.Duration(timeout))
|
||||||
|
AcctMgr.Grab()
|
||||||
_ = AcctMgr.LockWallets()
|
_ = AcctMgr.LockWallets()
|
||||||
|
AcctMgr.Release()
|
||||||
}(cmd.Timeout)
|
}(cmd.Timeout)
|
||||||
|
|
||||||
return nil, nil
|
return nil, nil
|
||||||
|
|
Loading…
Add table
Reference in a new issue