channeldb: create new channeldb package, update lnwallet to use new API

* Initial draft of brain dump of chandler. Nothing yet set in stone.
* Will most likely move the storage of all structs to a more “column”
oriented approach. Such that, small updates like incrementing the total
satoshi sent don’t result in the entire struct being serialized and
written.
* Some skeleton structs for other possible data we might want to store
are also included.
* Seem valuable to record as much data as possible for record keeping,
visualization, debugging, etc. Will need to set up a time+space+dirty
cache to ensure performance isn’t impacted too much.
This commit is contained in:
Olaoluwa Osuntokun committed 2015-12-26 12:35:15 -06:00
1 parent d7a1c5d337
commit 4fdb2763e6
13 files changed
+194 -131

No files matched your search

+4 -2
View File
@@ -3,6 +3,8 @@ package lnwallet
import (
"sync"
"li.lan/labs/plasma/channeldb"
"github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil"
@@ -64,7 +66,7 @@ type ChannelReservation struct {
ourContribution *ChannelContribution
theirContribution *ChannelContribution
partialState *OpenChannelState
partialState *channeldb.OpenChannel
// The ID of this reservation, used to uniquely track the reservation
// throughout its lifetime.
@@ -90,7 +92,7 @@ func newChannelReservation(t FundingType, fundingAmt btcutil.Amount,
theirContribution: &ChannelContribution{
FundingAmount: fundingAmt,
},
partialState: &OpenChannelState{
partialState: &channeldb.OpenChannel{
// TODO(roasbeef): assumes balanced symmetric channels.
Capacity: fundingAmt * 2,
OurBalance: fundingAmt,