Commit 322dd7ae authored by David Vorick's avatar David Vorick

add reference siafund keys to types package

parent e7d1d585
package wallet
import (
"testing"
"github.com/NebulousLabs/Sia/types"
)
// TestSiagKeyLoading loads the types testing keys into memory and checks that
// the wallet correctly discovers them.
func TestSiagKeyLoading(t *testing.T) {
wt, err := createWalletTester("TestSiagKeyLoading")
if err != nil {
t.Fatal(err)
}
// Check that 0 siafunds are recognized by the wallet.
siafundBalance, siacoinClaimBalance := wt.wallet.SiafundBalance()
if siafundBalance.Cmp(types.ZeroCurrency) != 0 || siacoinClaimBalance.Cmp(types.ZeroCurrency) != 0 {
t.Fatal("Wallet did not start with empty siafund and siaclaim balances")
}
// Load the 1-of-1 key and see if it is recognized after restart.
err := wt.wallet.AddSiagSiafundAddress("../../types.go/siag0of1of1.siakey")
if err != nil {
t.Fatal(err)
}
// TODO: Need some way to rescan. Until then, manual testing will need to
// suffice.
}
......@@ -24,6 +24,8 @@ type walletTester struct {
tpoolUpdateChan <-chan struct{}
minerUpdateChan <-chan struct{}
walletUpdateChan <-chan struct{}
persistDir string
}
// spendCoins sends the desired amount of coins to the desired address, calling
......@@ -110,6 +112,8 @@ func createWalletTester(name string) (*walletTester, error) {
tpoolUpdateChan: tp.TransactionPoolNotify(),
minerUpdateChan: m.MinerNotify(),
walletUpdateChan: w.WalletNotify(),
persistDir: testdir,
}
// Mine blocks until there is money in the wallet.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment