@@ -33,6 +33,12 @@ class PreselectedInput
3333 std::optional<int64_t > m_weight;
3434 // ! The sequence number for this input
3535 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;
3642
3743public:
3844 /* *
@@ -54,6 +60,20 @@ class PreselectedInput
5460 void SetSequence (uint32_t sequence);
5561 /* * Retrieve the sequence for this input. */
5662 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 ;
5777};
5878
5979/* * Coin Control Features. */
@@ -141,10 +161,27 @@ class CCoinControl
141161 std::optional<int64_t > GetInputWeight (const COutPoint& outpoint) const ;
142162 /* * Retrieve the sequence for an input */
143163 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+ }
144180
145181private:
146182 // ! Selected inputs (inputs that will be used, regardless of whether they're optimal or not)
147183 std::map<COutPoint, PreselectedInput> m_selected;
184+ unsigned int m_selection_pos{0 };
148185};
149186} // namespace wallet
150187
0 commit comments