@@ -33,6 +33,12 @@ class PreselectedInput
33
33
std::optional<int64_t > m_weight;
34
34
// ! The sequence number for this input
35
35
std::optional<uint32_t > m_sequence;
36
+ // ! The scriptSig for this input
37
+ std::optional<CScript> m_script_sig;
38
+ // ! The scriptWitness for this input
39
+ std::optional<CScriptWitness> m_script_witness;
40
+ // ! The position in the inputs vector for this input
41
+ std::optional<unsigned int > m_pos;
36
42
37
43
public:
38
44
/* *
@@ -54,6 +60,20 @@ class PreselectedInput
54
60
void SetSequence (uint32_t sequence);
55
61
/* * Retrieve the sequence for this input. */
56
62
std::optional<uint32_t > GetSequence () const ;
63
+
64
+ /* * Set the scriptSig for this input. */
65
+ void SetScriptSig (const CScript& script);
66
+ /* * Set the scriptWitness for this input. */
67
+ void SetScriptWitness (const CScriptWitness& script_wit);
68
+ /* * Return whether either the scriptSig or scriptWitness are set for this input. */
69
+ bool HasScripts () const ;
70
+ /* * Retrieve both the scriptSig and the scriptWitness. */
71
+ std::pair<std::optional<CScript>, std::optional<CScriptWitness>> GetScripts () const ;
72
+
73
+ /* * Store the position of this input. */
74
+ void SetPosition (unsigned int pos);
75
+ /* * Retrieve the position of this input. */
76
+ std::optional<unsigned int > GetPosition () const ;
57
77
};
58
78
59
79
/* * Coin Control Features. */
@@ -141,10 +161,27 @@ class CCoinControl
141
161
std::optional<int64_t > GetInputWeight (const COutPoint& outpoint) const ;
142
162
/* * Retrieve the sequence for an input */
143
163
std::optional<uint32_t > GetSequence (const COutPoint& outpoint) const ;
164
+ /* * Retrieves the scriptSig and scriptWitness for an input. */
165
+ std::pair<std::optional<CScript>, std::optional<CScriptWitness>> GetScripts (const COutPoint& outpoint) const ;
166
+
167
+ bool HasSelectedOrder () const
168
+ {
169
+ return m_selection_pos > 0 ;
170
+ }
171
+
172
+ std::optional<unsigned int > GetSelectionPos (const COutPoint& outpoint) const
173
+ {
174
+ const auto it = m_selected.find (outpoint);
175
+ if (it == m_selected.end ()) {
176
+ return std::nullopt;
177
+ }
178
+ return it->second .GetPosition ();
179
+ }
144
180
145
181
private:
146
182
// ! Selected inputs (inputs that will be used, regardless of whether they're optimal or not)
147
183
std::map<COutPoint, PreselectedInput> m_selected;
184
+ unsigned int m_selection_pos{0 };
148
185
};
149
186
} // namespace wallet
150
187
0 commit comments