htlcswitch: update tests to account for new API changes

This commit is contained in:
Olaoluwa Osuntokun committed 2018-01-22 19:19:41 -08:00
1 parent dbe76a1507
commit e34850c7af
3 files changed
+103 -12

No files matched your search

+30
View File
@@ -16,6 +16,7 @@ import (
"github.com/go-errors/errors"
"github.com/lightningnetwork/lnd/chainntnfs"
"github.com/lightningnetwork/lnd/channeldb"
"github.com/lightningnetwork/lnd/contractcourt"
"github.com/lightningnetwork/lnd/lnwallet"
"github.com/lightningnetwork/lnd/lnwire"
"github.com/roasbeef/btcd/btcec"
@@ -25,6 +26,35 @@ import (
"github.com/roasbeef/btcutil"
)
type mockPreimageCache struct {
sync.Mutex
preimageMap map[[32]byte][]byte
}
func (m *mockPreimageCache) LookupPreimage(hash []byte) ([]byte, bool) {
m.Lock()
defer m.Unlock()
var h [32]byte
copy(h[:], hash)
p, ok := m.preimageMap[h]
return p, ok
}
func (m *mockPreimageCache) AddPreimage(preimage []byte) error {
m.Lock()
defer m.Unlock()
m.preimageMap[sha256.Sum256(preimage[:])] = preimage
return nil
}
func (m *mockPreimageCache) SubcribeUpdates() *contractcourt.WitnessSubcription {
return nil
}
type mockFeeEstimator struct {
byteFeeIn chan btcutil.Amount
weightFeeIn chan btcutil.Amount