rename revocation package to shachain

* Constructors now also more in line with “Effective Go”
This commit is contained in:
Olaoluwa Osuntokun 2015-12-24 12:42:03 -06:00
parent 07646d05db
commit 15f15bb3af
5 changed files with 8 additions and 20 deletions

View File

@ -11,7 +11,7 @@ import (
"sync" "sync"
"sync/atomic" "sync/atomic"
"li.lan/labs/plasma/revocation" "li.lan/labs/plasma/shachain"
"github.com/btcsuite/btcd/btcec" "github.com/btcsuite/btcd/btcec"
"github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg"
@ -437,7 +437,7 @@ func (l *LightningWallet) handleFundingReserveRequest(req *initFundingReserveMsg
ourContribution.DeliveryAddress = addrs[0].Address() ourContribution.DeliveryAddress = addrs[0].Address()
// Create a new shaChain for verifiable transaction revocations. // Create a new shaChain for verifiable transaction revocations.
shaChain, err := revocation.NewHyperShaChainFromSeed(nil, 0) shaChain, err := shachain.NewFromSeed(nil, 0)
if err != nil { if err != nil {
req.err <- err req.err <- err
req.resp <- nil req.resp <- nil
@ -604,8 +604,8 @@ func (l *LightningWallet) handleContributionMsg(req *addContributionMsg) {
// Initialize an empty sha-chain for them, tracking the current pending // 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 // revocation hash (we don't yet know the pre-image so we can't add it
// to the chain). // to the chain).
pendingReservation.partialState.theirShaChain = revocation.NewHyperShaChain() pendingReservation.partialState.TheirShaChain = shachain.New()
pendingReservation.partialState.theirCurrentRevocation = theirContribution.RevocationHash pendingReservation.partialState.TheirCurrentRevocation = theirContribution.RevocationHash
// Grab the hash of the current pre-image in our chain, this is needed // Grab the hash of the current pre-image in our chain, this is needed
// for out commitment tx. // for out commitment tx.

View File

@ -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 {
}

View File

@ -1,3 +0,0 @@
package revocation
import "testing"

View File

@ -1,4 +1,4 @@
package revocation package shachain
import ( import (
"bytes" "bytes"
@ -36,13 +36,13 @@ type HyperShaChain struct {
// NewHyperShaChain // NewHyperShaChain
// * used to track their pre-images // * used to track their pre-images
func NewHyperShaChain() *HyperShaChain { func New() *HyperShaChain {
return &HyperShaChain{lastChainIndex: 0, numValid: 0} return &HyperShaChain{lastChainIndex: 0, numValid: 0}
} }
// NewHyperShaChainFromSeed... // NewHyperShaChainFromSeed...
// * used to derive your own pre-images // * 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 var shaSeed [32]byte
// If no seed is specified, generate a new one. // If no seed is specified, generate a new one.

View File

@ -0,0 +1 @@
package shachain