-
Notifications
You must be signed in to change notification settings - Fork 1
/
bumpfee.go
62 lines (52 loc) · 1.72 KB
/
bumpfee.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package wltbtc
import (
"github.com/btcsuite/btcd/wire"
"github.com/dev-warrior777/go-electrum-client/wallet"
)
// var BumpFeeAlreadyConfirmedError = errors.New("transaction is confirmed, cannot bump fee")
// var BumpFeeTransactionDeadError = errors.New("cannot bump fee of dead transaction")
// var BumpFeeNotFoundError = errors.New("transaction either doesn't exist or has already been spent")
func (w *BtcElectrumWallet) BumpFee(txid string) (*wire.MsgTx, error) {
return nil, wallet.ErrWalletFnNotImplemented // FIXME: SweepAddress prevOutputFInder
// txn, err := w.txstore.Txns().Get(txid)
// if err != nil {
// return nil, err
// }
// if txn.Height > 0 {
// return nil, BumpFeeAlreadyConfirmedError
// }
// if txn.Height < 0 {
// return nil, BumpFeeTransactionDeadError
// }
// // As a policy this wallet will never do RBF.
// // Check utxos for CPFP
// utxos, _ := w.txstore.Utxos().GetAll()
// for _, u := range utxos {
// if u.Op.Hash.IsEqual(&txid) && u.AtHeight == 0 {
// addr, err := w.ScriptToAddress(u.ScriptPubkey)
// if err != nil {
// return nil, err
// }
// key, err := w.keyManager.GetKeyForScript(addr.ScriptAddress())
// if err != nil {
// return nil, err
// }
// in := wallet.TransactionInput{
// LinkedAddress: addr,
// OutpointIndex: u.Op.Index,
// OutpointHash: u.Op.Hash.CloneBytes(),
// Value: u.Value,
// }
// newAddress, err := w.GetUnusedAddress(wallet.INTERNAL)
// if err != nil {
// return nil, err
// }
// tx, err := w.SweepAddress([]wallet.TransactionInput{in}, newAddress, key, nil, wallet.FEE_BUMP)
// if err != nil {
// return nil, err
// }
// return tx, nil
// }
// }
// return nil, BumpFeeNotFoundError
}