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

@ -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.

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

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

@ -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.

@ -0,0 +1 @@
package shachain