Merge pull request #4423 from breez/enable-encode-invoice-via-rpc

Let invoice.Encode receive a function which hashes itself the message
This commit is contained in:
Johan T. Halseth authored and GitHub committed 2020-11-19 14:44:38 +01:00
commit ef8a61db99
4 files changed
+14 -9

No files matched your search

+5 -1
View File
@@ -10,6 +10,7 @@ import (
"time"
"github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
"github.com/davecgh/go-spew/spew"
@@ -329,7 +330,10 @@ func AddInvoice(ctx context.Context, cfg *AddInvoiceConfig,
payReqString, err := payReq.Encode(
zpay32.MessageSigner{
SignCompact: cfg.NodeSigner.SignDigestCompact,
SignCompact: func(msg []byte) ([]byte, error) {
hash := chainhash.HashB(msg)
return cfg.NodeSigner.SignDigestCompact(hash)
},
},
)
if err != nil {