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

Method Merge

src/psbt.cpp:38–71  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

36}
37
38bool PartiallySignedTransaction::Merge(const PartiallySignedTransaction& psbt)
39{
40 // Prohibited to merge two PSBTs over different transactions
41 if (GetUniqueID() != psbt.GetUniqueID()) {
42 return false;
43 }
44
45 assert(*tx_version == psbt.tx_version);
46 for (unsigned int i = 0; i < inputs.size(); ++i) {
47 if (!inputs[i].Merge(psbt.inputs[i])) {
48 return false;
49 }
50 }
51 for (unsigned int i = 0; i < outputs.size(); ++i) {
52 if (!outputs[i].Merge(psbt.outputs[i])) {
53 return false;
54 }
55 }
56 for (auto& xpub_pair : psbt.m_xpubs) {
57 if (m_xpubs.count(xpub_pair.first) == 0) {
58 m_xpubs[xpub_pair.first] = xpub_pair.second;
59 } else {
60 m_xpubs[xpub_pair.first].insert(xpub_pair.second.begin(), xpub_pair.second.end());
61 }
62 }
63 for (auto& scalar : psbt.m_scalar_offsets) {
64 m_scalar_offsets.insert(scalar);
65 }
66 if (fallback_locktime == std::nullopt && psbt.fallback_locktime != std::nullopt) fallback_locktime = psbt.fallback_locktime;
67 if (m_tx_modifiable == std::nullopt && psbt.m_tx_modifiable != std::nullopt) m_tx_modifiable = psbt.m_tx_modifiable;
68 unknown.insert(psbt.unknown.begin(), psbt.unknown.end());
69
70 return true;
71}
72
73bool PartiallySignedTransaction::ComputeTimeLock(uint32_t& locktime) const
74{

Callers 1

CombinePSBTsFunction · 0.45

Calls 13

GetUniqueIDMethod · 0.80
countMethod · 0.80
IsBlindedMethod · 0.80
IsFullyBlindedMethod · 0.80
sizeMethod · 0.45
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
IsNullMethod · 0.45
emptyMethod · 0.45
resetMethod · 0.45
indexMethod · 0.45

Tested by

no test coverage detected