fix appending over key
This commit is contained in:
parent
b3d6a59c61
commit
aa243565ce
|
@ -162,6 +162,7 @@ func (k Keeper) GetRedelegationsFromValidator(ctx sdk.Context, valAddr sdk.Addre
|
||||||
fmt.Println("called")
|
fmt.Println("called")
|
||||||
//redelegationKey := iterator.Value()
|
//redelegationKey := iterator.Value()
|
||||||
iKey := iterator.Key()
|
iKey := iterator.Key()
|
||||||
|
fmt.Println("LEN IT", len(iKey))
|
||||||
redelegationKey := GetREDKeyFromValSrcIndexKey(iKey)
|
redelegationKey := GetREDKeyFromValSrcIndexKey(iKey)
|
||||||
fmt.Printf("debug iteratorValue: %v\n", iterator.Value())
|
fmt.Printf("debug iteratorValue: %v\n", iterator.Value())
|
||||||
fmt.Printf("debug iteratorKey: %v\n", iKey)
|
fmt.Printf("debug iteratorKey: %v\n", iKey)
|
||||||
|
|
|
@ -162,12 +162,13 @@ func GetUBDsByValIndexKey(validatorAddr sdk.Address) []byte {
|
||||||
func GetREDKey(delegatorAddr, validatorSrcAddr,
|
func GetREDKey(delegatorAddr, validatorSrcAddr,
|
||||||
validatorDstAddr sdk.Address) []byte {
|
validatorDstAddr sdk.Address) []byte {
|
||||||
|
|
||||||
return append(
|
fmt.Println("KEY", delegatorAddr.Bytes())
|
||||||
GetREDsKey(delegatorAddr),
|
key := make([]byte, len(delegatorAddr.Bytes()))
|
||||||
append(
|
copy(key, delegatorAddr.Bytes())
|
||||||
validatorSrcAddr.Bytes(),
|
|
||||||
validatorDstAddr.Bytes()...)...,
|
return append(append(
|
||||||
)
|
GetREDsKey(key), validatorSrcAddr.Bytes()...),
|
||||||
|
validatorDstAddr.Bytes()...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// get the index-key for a redelegation, stored by source-validator-index
|
// get the index-key for a redelegation, stored by source-validator-index
|
||||||
|
@ -206,10 +207,18 @@ func GetREDKeyFromValSrcIndexKey(IndexKey []byte) []byte {
|
||||||
valSrcAddr := addrs[:split]
|
valSrcAddr := addrs[:split]
|
||||||
delAddr := addrs[split : 2*split]
|
delAddr := addrs[split : 2*split]
|
||||||
valDstAddr := addrs[2*split:]
|
valDstAddr := addrs[2*split:]
|
||||||
fmt.Printf("debug delAddr: %v\n", delAddr)
|
fmt.Printf("debug indexKey: %v\n", IndexKey)
|
||||||
fmt.Printf("debug valSrcAddr: %v\n", valSrcAddr)
|
fmt.Printf("debug valSrcAddr: %v\n", valSrcAddr)
|
||||||
|
fmt.Printf("debug delAddr: %v\n", delAddr)
|
||||||
fmt.Printf("debug valDstAddr: %v\n", valDstAddr)
|
fmt.Printf("debug valDstAddr: %v\n", valDstAddr)
|
||||||
return GetREDKey(delAddr, valSrcAddr, valDstAddr)
|
redKey := GetREDKey(delAddr, valSrcAddr, valDstAddr)
|
||||||
|
fmt.Println("------")
|
||||||
|
fmt.Printf("debug indexKey: %v\n", IndexKey)
|
||||||
|
fmt.Printf("debug valSrcAddr: %v\n", valSrcAddr)
|
||||||
|
fmt.Printf("debug delAddr: %v\n", delAddr)
|
||||||
|
fmt.Printf("debug valDstAddr: %v\n", valDstAddr)
|
||||||
|
fmt.Println("")
|
||||||
|
return redKey
|
||||||
}
|
}
|
||||||
|
|
||||||
// rearrange the ValDstIndexKey to get the REDKey
|
// rearrange the ValDstIndexKey to get the REDKey
|
||||||
|
|
Loading…
Reference in New Issue