mirror of
https://github.com/kvazar-network/kevacoin.git
synced 2025-01-13 00:28:03 +00:00
Used SegWit address for keva_delete.
This commit is contained in:
parent
c763ddc985
commit
8c5def9909
@ -360,11 +360,10 @@ UniValue keva_delete(const JSONRPCRequest& request)
|
|||||||
CPubKey pubKeyReserve;
|
CPubKey pubKeyReserve;
|
||||||
const bool ok = keyName.GetReservedKey(pubKeyReserve, true);
|
const bool ok = keyName.GetReservedKey(pubKeyReserve, true);
|
||||||
assert(ok);
|
assert(ok);
|
||||||
bool usedKey = false;
|
|
||||||
|
|
||||||
CScript addrName;
|
CScript redeemScript = GetScriptForDestination(WitnessV0KeyHash(pubKeyReserve.GetID()));
|
||||||
usedKey = true;
|
CScriptID scriptHash = CScriptID(redeemScript);
|
||||||
addrName = GetScriptForDestination(pubKeyReserve.GetID());
|
CScript addrName = GetScriptForDestination(scriptHash);
|
||||||
|
|
||||||
const CScript kevaScript = CKevaScript::buildKevaDelete(addrName, nameSpace, key);
|
const CScript kevaScript = CKevaScript::buildKevaDelete(addrName, nameSpace, key);
|
||||||
|
|
||||||
@ -374,9 +373,7 @@ UniValue keva_delete(const JSONRPCRequest& request)
|
|||||||
SendMoneyToScript(pwallet, kevaScript, &txIn, empty,
|
SendMoneyToScript(pwallet, kevaScript, &txIn, empty,
|
||||||
KEVA_LOCKED_AMOUNT, false, wtx, coinControl);
|
KEVA_LOCKED_AMOUNT, false, wtx, coinControl);
|
||||||
|
|
||||||
if (usedKey) {
|
keyName.KeepKey();
|
||||||
keyName.KeepKey();
|
|
||||||
}
|
|
||||||
|
|
||||||
UniValue obj(UniValue::VOBJ);
|
UniValue obj(UniValue::VOBJ);
|
||||||
obj.pushKV("txid", wtx.GetHash().GetHex());
|
obj.pushKV("txid", wtx.GetHash().GetHex());
|
||||||
|
7
test/functional/feature_keva.py
Normal file → Executable file
7
test/functional/feature_keva.py
Normal file → Executable file
@ -92,5 +92,12 @@ class KevaTest(BitcoinTestFramework):
|
|||||||
response = self.nodes[0].keva_get(namespaceId, keyToDelete)
|
response = self.nodes[0].keva_get(namespaceId, keyToDelete)
|
||||||
assert(response['value'] == '')
|
assert(response['value'] == '')
|
||||||
|
|
||||||
|
self.log.info("Test reset the value after deleting")
|
||||||
|
newValue = 'This is the new value'
|
||||||
|
self.nodes[0].keva_put(namespaceId, keyToDelete, newValue)
|
||||||
|
self.nodes[0].generate(1)
|
||||||
|
response = self.nodes[0].keva_get(namespaceId, keyToDelete)
|
||||||
|
assert(response['value'] == newValue)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
KevaTest().main()
|
KevaTest().main()
|
||||||
|
Loading…
Reference in New Issue
Block a user