Skip to content

Commit

Permalink
fix: restore test
Browse files Browse the repository at this point in the history
  • Loading branch information
willemneal committed Oct 12, 2023
1 parent 1c47ba8 commit 6f73d43
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions cmd/soroban-rpc/internal/test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,23 +211,11 @@ func TestCLIRestore(t *testing.T) {
),
)

newExpirationSeq := getExpirationForLedgerEntry(t, client, getExpirationKey(t, getCounterLedgerKey(parseContractStrKey(t, strkeyContractID))))
newExpirationSeq := getExpirationForLedgerEntry(t, client, getCounterLedgerKey(parseContractStrKey(t, strkeyContractID)))
assert.Greater(t, newExpirationSeq, initialExpirationSeq)
assert.Equal(t, fmt.Sprintf("New expiration ledger: %d", newExpirationSeq), restoreOutput)
}

func getExpirationKey(t *testing.T, key xdr.LedgerKey) xdr.LedgerKey {
assert.True(t, key.Type == xdr.LedgerEntryTypeContractCode || key.Type == xdr.LedgerEntryTypeContractData)
binKey, err := key.MarshalBinary()
assert.NoError(t, err)
return xdr.LedgerKey{
Type: xdr.LedgerEntryTypeExpiration,
Expiration: &xdr.LedgerKeyExpiration{
KeyHash: sha256.Sum256(binKey),
},
}
}

func parseContractStrKey(t *testing.T, strkeyContractID string) [32]byte {
contractIDBytes := strkey.MustDecode(strkey.VersionByteContract, strkeyContractID)
var contractID [32]byte
Expand Down

0 comments on commit 6f73d43

Please sign in to comment.