diff --git a/lnwallet/wallet.go b/lnwallet/wallet.go index 37c9a588..a063ace7 100644 --- a/lnwallet/wallet.go +++ b/lnwallet/wallet.go @@ -11,7 +11,7 @@ import ( "sync" "sync/atomic" - "li.lan/labs/plasma/revocation" + "li.lan/labs/plasma/shachain" "github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/chaincfg" @@ -437,7 +437,7 @@ func (l *LightningWallet) handleFundingReserveRequest(req *initFundingReserveMsg ourContribution.DeliveryAddress = addrs[0].Address() // Create a new shaChain for verifiable transaction revocations. - shaChain, err := revocation.NewHyperShaChainFromSeed(nil, 0) + shaChain, err := shachain.NewFromSeed(nil, 0) if err != nil { req.err <- err req.resp <- nil @@ -604,8 +604,8 @@ func (l *LightningWallet) handleContributionMsg(req *addContributionMsg) { // Initialize an empty sha-chain for them, tracking the current pending // revocation hash (we don't yet know the pre-image so we can't add it // to the chain). - pendingReservation.partialState.theirShaChain = revocation.NewHyperShaChain() - pendingReservation.partialState.theirCurrentRevocation = theirContribution.RevocationHash + pendingReservation.partialState.TheirShaChain = shachain.New() + pendingReservation.partialState.TheirCurrentRevocation = theirContribution.RevocationHash // Grab the hash of the current pre-image in our chain, this is needed // for out commitment tx. diff --git a/revocation/revocation.go b/revocation/revocation.go deleted file mode 100644 index df1c544f..00000000 --- a/revocation/revocation.go +++ /dev/null @@ -1,10 +0,0 @@ -package revocation - -// TODO(roasbeef): -// * fin..later -// * reg HD Chain -// * Codeshark's sub-branch proposal -// * Rusty's hypercube shachain -// * more...idk? -type VerifiableRevocation interface { -} diff --git a/revocation/shachain_test.go b/revocation/shachain_test.go deleted file mode 100644 index 39f8849e..00000000 --- a/revocation/shachain_test.go +++ /dev/null @@ -1,3 +0,0 @@ -package revocation - -import "testing" diff --git a/revocation/shachain.go b/shachain/shachain.go similarity index 96% rename from revocation/shachain.go rename to shachain/shachain.go index 28ce090d..aafe5ebd 100644 --- a/revocation/shachain.go +++ b/shachain/shachain.go @@ -1,4 +1,4 @@ -package revocation +package shachain import ( "bytes" @@ -36,13 +36,13 @@ type HyperShaChain struct { // NewHyperShaChain // * used to track their pre-images -func NewHyperShaChain() *HyperShaChain { +func New() *HyperShaChain { return &HyperShaChain{lastChainIndex: 0, numValid: 0} } // NewHyperShaChainFromSeed... // * used to derive your own pre-images -func NewHyperShaChainFromSeed(seed *[32]byte, deriveTo uint64) (*HyperShaChain, error) { +func NewFromSeed(seed *[32]byte, deriveTo uint64) (*HyperShaChain, error) { var shaSeed [32]byte // If no seed is specified, generate a new one. diff --git a/shachain/shachain_test.go b/shachain/shachain_test.go new file mode 100644 index 00000000..531b9204 --- /dev/null +++ b/shachain/shachain_test.go @@ -0,0 +1 @@ +package shachain