rocksdb #29
3 changed files with 27 additions and 11 deletions
|
@ -413,12 +413,6 @@ 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.
|
// TestGetClaimToTXO Tests getting a ClaimToTXO value from the db.
|
||||||
func TestGetSupportAmount(t *testing.T) {
|
func TestGetSupportAmount(t *testing.T) {
|
||||||
claimHashStr := "2556ed1cab9d17f2a9392030a9ad7f5d138f11bd"
|
claimHashStr := "2556ed1cab9d17f2a9392030a9ad7f5d138f11bd"
|
||||||
|
@ -445,6 +439,27 @@ func TestGetSupportAmount(t *testing.T) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: verify where this hash comes from exactly.
|
||||||
|
func TestGetTxHash(t *testing.T) {
|
||||||
|
txNum := uint32(0x6284e3)
|
||||||
|
want := "54e14ff0c404c29b3d39ae4d249435f167d5cd4ce5a428ecb745b3df1c8e3dde"
|
||||||
|
|
||||||
|
filePath := "../testdata/X_resolve.csv"
|
||||||
|
db, _, toDefer, err := OpenAndFillTmpDBColumnFamlies(filePath)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
defer toDefer()
|
||||||
|
resHash, err := dbpkg.GetTxHash(db, txNum)
|
||||||
|
if err != nil {
|
||||||
|
t.Error(err)
|
||||||
|
}
|
||||||
|
resStr := hex.EncodeToString(resHash)
|
||||||
|
if want != resStr {
|
||||||
|
t.Errorf("Expected %s, got %s", want, resStr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func TestGetExpirationHeight(t *testing.T) {
|
func TestGetExpirationHeight(t *testing.T) {
|
||||||
var lastUpdated uint32 = 0
|
var lastUpdated uint32 = 0
|
||||||
var expHeight uint32 = 0
|
var expHeight uint32 = 0
|
||||||
|
|
9
main.go
9
main.go
|
@ -3,7 +3,6 @@ package main
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"encoding/hex"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
|
@ -111,17 +110,17 @@ func main() {
|
||||||
|
|
||||||
return
|
return
|
||||||
} else if args.CmdType == server.DBCmd3 {
|
} else if args.CmdType == server.DBCmd3 {
|
||||||
channelHash, _ := hex.DecodeString("2556ed1cab9d17f2a9392030a9ad7f5d138f11bd")
|
// channelHash, _ := hex.DecodeString("2556ed1cab9d17f2a9392030a9ad7f5d138f11bd")
|
||||||
// name := util.NormalizeName("@Styxhexenhammer666")
|
// name := util.NormalizeName("@Styxhexenhammer666")
|
||||||
// txNum := uint32(0x6284e3)
|
txNum := uint32(0x6284e3)
|
||||||
// position := uint16(0x0)
|
// position := uint16(0x0)
|
||||||
// typ := uint8(prefixes.ACTIVATED_CLAIM_TXO_TYPE)
|
// typ := uint8(prefixes.ACTIVATED_CLAIM_TXO_TYPE)
|
||||||
var rawPrefix byte = prefixes.SupportAmount
|
var rawPrefix byte = prefixes.TxHash
|
||||||
var startRaw []byte = nil
|
var startRaw []byte = nil
|
||||||
prefix := []byte{rawPrefix}
|
prefix := []byte{rawPrefix}
|
||||||
columnFamily := string(prefix)
|
columnFamily := string(prefix)
|
||||||
// start := prefixes.NewClaimTakeoverKey(name)
|
// start := prefixes.NewClaimTakeoverKey(name)
|
||||||
start := prefixes.NewSupportAmountKey(channelHash)
|
start := prefixes.NewTxHashKey(txNum)
|
||||||
startRaw = start.PackKey()
|
startRaw = start.PackKey()
|
||||||
// start := &prefixes.ChannelCountKey{
|
// start := &prefixes.ChannelCountKey{
|
||||||
// Prefix: prefix,
|
// Prefix: prefix,
|
||||||
|
|
2
testdata/X_resolve.csv
vendored
Normal file
2
testdata/X_resolve.csv
vendored
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
X,,
|
||||||
|
X,58006284e3,54e14ff0c404c29b3d39ae4d249435f167d5cd4ce5a428ecb745b3df1c8e3dde
|
|
Loading…
Reference in a new issue