MCPcopy Create free account
hub / github.com/ElementsProject/elements / pushvalue

Function pushvalue

src/script/interpreter.cpp:105–122  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103}
104
105static inline void pushvalue(std::vector<valtype>& stack, const CConfidentialValue& value)
106{
107 valtype vchinpValue, vchValuePref;
108 if (value.IsNull()) {
109 // If value is null, explicitly push the explicit prefix 0x01
110 vchValuePref = {0x01};
111 vchinpValue.assign(8, 0x00);
112 } else if (value.IsExplicit()) {
113 // Convert BE to LE by using reverse iterator
114 vchValuePref.assign(value.vchCommitment.begin(), value.vchCommitment.begin() + 1);
115 vchinpValue.assign(value.vchCommitment.rbegin(), value.vchCommitment.rbegin() + 8);
116 } else { // (value.IsCommitment())
117 vchValuePref.assign(value.vchCommitment.begin(), value.vchCommitment.begin() + 1);
118 vchinpValue.assign(value.vchCommitment.begin() + 1, value.vchCommitment.end());
119 }
120 stack.push_back(std::move(vchinpValue)); // if value is null, 0(LE 8) is pushed
121 stack.push_back(std::move(vchValuePref)); // always push prefix
122}
123
124static inline void pushspk(std::vector<valtype>& stack, const CScript& scriptPubKey, const uint256& scriptPubKey_sha)
125{

Callers 1

EvalScriptFunction · 0.85

Calls 7

IsExplicitMethod · 0.80
rbeginMethod · 0.80
IsNullMethod · 0.45
assignMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected