another test
This commit is contained in:
parent
8d1135189d
commit
c73c078c26
3 changed files with 41 additions and 6 deletions
|
@ -413,6 +413,38 @@ func TestGetTXOToClaim(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
// TestPrintClaimToTXO Utility function to cat the ClaimToTXO csv.
|
||||
func TestPrintSupportAmount(t *testing.T) {
|
||||
filePath := "../testdata/a_resolve.csv"
|
||||
CatCSV(filePath)
|
||||
}
|
||||
|
||||
// TestGetClaimToTXO Tests getting a ClaimToTXO value from the db.
|
||||
func TestGetSupportAmount(t *testing.T) {
|
||||
claimHashStr := "2556ed1cab9d17f2a9392030a9ad7f5d138f11bd"
|
||||
want := uint64(8654754160700)
|
||||
claimHash, err := hex.DecodeString(claimHashStr)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
filePath := "../testdata/a_resolve.csv"
|
||||
db, _, toDefer, err := OpenAndFillTmpDBColumnFamlies(filePath)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
defer toDefer()
|
||||
res, err := dbpkg.GetSupportAmount(db, claimHash)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
return
|
||||
}
|
||||
if res != want {
|
||||
t.Errorf("Expected %d, got %d", want, res)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetExpirationHeight(t *testing.T) {
|
||||
var lastUpdated uint32 = 0
|
||||
var expHeight uint32 = 0
|
||||
|
|
13
main.go
13
main.go
|
@ -3,6 +3,7 @@ package main
|
|||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
|
@ -110,17 +111,17 @@ func main() {
|
|||
|
||||
return
|
||||
} else if args.CmdType == server.DBCmd3 {
|
||||
// channelHash, _ := hex.DecodeString("2556ed1cab9d17f2a9392030a9ad7f5d138f11bd")
|
||||
channelHash, _ := hex.DecodeString("2556ed1cab9d17f2a9392030a9ad7f5d138f11bd")
|
||||
// name := util.NormalizeName("@Styxhexenhammer666")
|
||||
txNum := uint32(0x6284e3)
|
||||
position := uint16(0x0)
|
||||
typ := uint8(prefixes.ACTIVATED_CLAIM_TXO_TYPE)
|
||||
var rawPrefix byte = prefixes.ActivatedClaimAndSupport
|
||||
// txNum := uint32(0x6284e3)
|
||||
// position := uint16(0x0)
|
||||
// typ := uint8(prefixes.ACTIVATED_CLAIM_TXO_TYPE)
|
||||
var rawPrefix byte = prefixes.SupportAmount
|
||||
var startRaw []byte = nil
|
||||
prefix := []byte{rawPrefix}
|
||||
columnFamily := string(prefix)
|
||||
// start := prefixes.NewClaimTakeoverKey(name)
|
||||
start := prefixes.NewActivationKey(typ, txNum, position)
|
||||
start := prefixes.NewSupportAmountKey(channelHash)
|
||||
startRaw = start.PackKey()
|
||||
// start := &prefixes.ChannelCountKey{
|
||||
// Prefix: prefix,
|
||||
|
|
2
testdata/a_resolve.csv
vendored
Normal file
2
testdata/a_resolve.csv
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
a,,
|
||||
a,612556ed1cab9d17f2a9392030a9ad7f5d138f11bd,000007df178c203c
|
|
Loading…
Reference in a new issue