From 1cab3e87f3b2f07e2ba9ff3d4d7ed904e78ec774 Mon Sep 17 00:00:00 2001 From: Orfeas Litos Date: Tue, 2 Nov 2021 22:34:42 +0100 Subject: Define BIP-119 CheckDefaultCheckTemplateVerifyHash --- bip-0119.mediawiki | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'bip-0119.mediawiki') diff --git a/bip-0119.mediawiki b/bip-0119.mediawiki index 658764d..b407fab 100644 --- a/bip-0119.mediawiki +++ b/bip-0119.mediawiki @@ -159,6 +159,12 @@ specification for the semantics of OP_CHECKTEMPLATEVERIFY. } break; +Where + + bool CheckDefaultCheckTemplateVerifyHash(uint256 hash) { + return GetDefaultCheckTemplateVerifyHash(current_tx, current_input_index) == hash; + } + The hash is computed as follows: uint256 GetDefaultCheckTemplateVerifyHash(const CTransaction& tx, uint32_t input_index) { -- cgit v1.2.3 From 897e6458ce921c6bbbf6b5891e3371dd21670a7c Mon Sep 17 00:00:00 2001 From: Orfeas Litos Date: Wed, 10 Nov 2021 23:40:20 +0100 Subject: Cast 8-vector of u32 to u256 --- bip-0119.mediawiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bip-0119.mediawiki') diff --git a/bip-0119.mediawiki b/bip-0119.mediawiki index b407fab..8a71e3e 100644 --- a/bip-0119.mediawiki +++ b/bip-0119.mediawiki @@ -145,7 +145,7 @@ specification for the semantics of OP_CHECKTEMPLATEVERIFY. // If the argument was not 32 bytes, treat as OP_NOP4: switch (stack.back().size()) { case 32: - if (!checker.CheckDefaultCheckTemplateVerifyHash(stack.back())) { + if (!checker.CheckDefaultCheckTemplateVerifyHash(u256(stack.back()))) { return set_error(serror, SCRIPT_ERR_TEMPLATE_MISMATCH); } break; -- cgit v1.2.3 From 1839f437797c20bca6bdde73e365f3c10d078930 Mon Sep 17 00:00:00 2001 From: Orfeas Litos Date: Thu, 11 Nov 2021 23:27:52 +0100 Subject: Fix typo --- bip-0119.mediawiki | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'bip-0119.mediawiki') diff --git a/bip-0119.mediawiki b/bip-0119.mediawiki index 8a71e3e..5d33a15 100644 --- a/bip-0119.mediawiki +++ b/bip-0119.mediawiki @@ -145,7 +145,7 @@ specification for the semantics of OP_CHECKTEMPLATEVERIFY. // If the argument was not 32 bytes, treat as OP_NOP4: switch (stack.back().size()) { case 32: - if (!checker.CheckDefaultCheckTemplateVerifyHash(u256(stack.back()))) { + if (!checker.CheckDefaultCheckTemplateVerifyHash(uint256(stack.back()))) { return set_error(serror, SCRIPT_ERR_TEMPLATE_MISMATCH); } break; -- cgit v1.2.3 From 3ff4a4ce9d52fa762fbb9b6f9da74b0b3689a11e Mon Sep 17 00:00:00 2001 From: Orfeas Litos Date: Fri, 12 Nov 2021 01:08:46 +0100 Subject: Convert inside CheckDefaultCheckTemplateVerifyHash --- bip-0119.mediawiki | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'bip-0119.mediawiki') diff --git a/bip-0119.mediawiki b/bip-0119.mediawiki index 5d33a15..6422ac7 100644 --- a/bip-0119.mediawiki +++ b/bip-0119.mediawiki @@ -145,7 +145,7 @@ specification for the semantics of OP_CHECKTEMPLATEVERIFY. // If the argument was not 32 bytes, treat as OP_NOP4: switch (stack.back().size()) { case 32: - if (!checker.CheckDefaultCheckTemplateVerifyHash(uint256(stack.back()))) { + if (!checker.CheckDefaultCheckTemplateVerifyHash(stack.back())) { return set_error(serror, SCRIPT_ERR_TEMPLATE_MISMATCH); } break; @@ -161,8 +161,8 @@ specification for the semantics of OP_CHECKTEMPLATEVERIFY. Where - bool CheckDefaultCheckTemplateVerifyHash(uint256 hash) { - return GetDefaultCheckTemplateVerifyHash(current_tx, current_input_index) == hash; + bool CheckDefaultCheckTemplateVerifyHash(const std::vector& hash) { + return GetDefaultCheckTemplateVerifyHash(current_tx, current_input_index) == uint256(hash); } The hash is computed as follows: -- cgit v1.2.3