discovery+server: make waiting proofs persistent
In this commit waiting proofs array have been replaced with persistant boltd storage which removes the possibility for the half proof to be lost during half proof exchange.
This commit is contained in:
1 parent
a3eee453c3
commit
8e4199ee92
4 files changed
+165
-85
No files matched your search
@@ -1,8 +1,6 @@
|
||||
package discovery
|
||||
|
||||
import (
|
||||
"encoding/binary"
|
||||
|
||||
"github.com/go-errors/errors"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
@@ -10,31 +8,6 @@ import (
|
||||
"github.com/roasbeef/btcd/btcec"
|
||||
)
|
||||
|
||||
// newProofKey constructs a new announcement signature message key.
|
||||
func newProofKey(chanID uint64, isRemote bool) waitingProofKey {
|
||||
return waitingProofKey{
|
||||
chanID: chanID,
|
||||
isRemote: isRemote,
|
||||
}
|
||||
}
|
||||
|
||||
// ToBytes returns a serialized representation of the key.
|
||||
func (k waitingProofKey) ToBytes() []byte {
|
||||
var key [9]byte
|
||||
|
||||
var b uint8
|
||||
if k.isRemote {
|
||||
b = 0
|
||||
} else {
|
||||
b = 1
|
||||
}
|
||||
|
||||
binary.BigEndian.PutUint64(key[:8], k.chanID)
|
||||
key[8] = b
|
||||
|
||||
return key[:]
|
||||
}
|
||||
|
||||
// createChanAnnouncement is a helper function which creates all channel
|
||||
// announcements given the necessary channel related database items. This
|
||||
// function is used to transform out databse structs into the coresponding wire
|
||||
|
||||
Reference in new issue
Block a user