6
6
"encoding/json"
7
7
"errors"
8
8
"fmt"
9
- "github.com/sputn1ck/glightning/jrpc2"
10
9
"io/ioutil"
11
10
"log"
12
11
"math"
@@ -15,6 +14,8 @@ import (
15
14
"strconv"
16
15
"sync/atomic"
17
16
"time"
17
+
18
+ "github.com/sputn1ck/glightning/jrpc2"
18
19
)
19
20
20
21
// taken from bitcoind
@@ -652,20 +653,21 @@ func (b *Elements) CreateWallet(walletName string) (string, error) {
652
653
}
653
654
654
655
type LoadWalletReq struct {
655
- FileName string `json:"filename"`
656
+ FileName string `json:"filename"`
657
+ LoadOnStartup bool `json:"load_on_startup"`
656
658
}
657
659
658
660
func (r * LoadWalletReq ) Name () string {
659
661
return "loadwallet"
660
662
}
661
663
662
- func (b * Elements ) LoadWallet (fileName string ) (string , error ) {
664
+ func (b * Elements ) LoadWallet (fileName string , loadOnStartup bool ) (string , error ) {
663
665
var resp WalletRes
664
666
err := b .request (& LoadWalletReq {
665
- FileName : fileName ,
667
+ FileName : fileName ,
668
+ LoadOnStartup : loadOnStartup ,
666
669
}, & resp )
667
670
return resp .WalletName , err
668
-
669
671
}
670
672
671
673
type ListWalletsReq struct {}
@@ -722,21 +724,21 @@ func (r *GetBlockHeaderReq) Name() string {
722
724
}
723
725
724
726
type GetBlockHeaderRes struct {
725
- Hash string `json:"hash"`
726
- Confirmations uint32 `json:"confirmations"`
727
- Height uint32 `json:"height"`
728
- Version uint32 `json:"version"`
729
- VersionHex string `json:"versionHex"`
730
- Merkleroot string `json:"merkleroot"`
731
- Time uint64 `json:"time"`
732
- Mediantime uint64 `json:"mediantime"`
733
- Nonce uint32 `json:"nonce"`
734
- Bits string `json:"bits"`
727
+ Hash string `json:"hash"`
728
+ Confirmations uint32 `json:"confirmations"`
729
+ Height uint32 `json:"height"`
730
+ Version uint32 `json:"version"`
731
+ VersionHex string `json:"versionHex"`
732
+ Merkleroot string `json:"merkleroot"`
733
+ Time uint64 `json:"time"`
734
+ Mediantime uint64 `json:"mediantime"`
735
+ Nonce uint32 `json:"nonce"`
736
+ Bits string `json:"bits"`
735
737
Difficulty float64 `json:"difficulty"`
736
- Chainwork string `json:"chainwork"`
737
- NTx uint32 `json:"nTx"`
738
- Previousblockhash string `json:"previousblockhash"`
739
- Nextblockhash string `json:"nextblockhash"`
738
+ Chainwork string `json:"chainwork"`
739
+ NTx uint32 `json:"nTx"`
740
+ Previousblockhash string `json:"previousblockhash"`
741
+ Nextblockhash string `json:"nextblockhash"`
740
742
}
741
743
742
744
func (b * Elements ) GetBlockHeader (blockHash string ) (* GetBlockHeaderRes , error ) {
0 commit comments