@@ -138,16 +138,18 @@ class BC_API transaction
138138 // / Assumes coinbase if prevout not populated (returns only legacy sigops).
139139 size_t signature_operations (bool bip16, bool bip141) const NOEXCEPT;
140140
141- // signature_hash exposed for op_check_multisig caching.
141+ // / signature_hash exposed for op_check_multisig caching.
142142 hash_digest signature_hash (const input_iterator& input, const script& sub,
143143 uint64_t value, uint8_t sighash_flags, script_version version,
144144 bool bip143) const NOEXCEPT;
145145
146+ // / Not used internally.
146147 bool check_signature (const ec_signature& signature,
147148 const data_slice& public_key, const script& sub, uint32_t index,
148149 uint64_t value, uint8_t sighash_flags, script_version version,
149150 bool bip143) const NOEXCEPT;
150151
152+ // / Not used internally.
151153 bool create_endorsement (endorsement& out, const ec_secret& secret,
152154 const script& sub, uint32_t index, uint64_t value,
153155 uint8_t sighash_flags, script_version version,
@@ -233,43 +235,50 @@ class BC_API transaction
233235
234236private:
235237 typedef struct { size_t nominal; size_t witnessed; } sizes;
238+
239+ static bool segregated (const chain::inputs& inputs) NOEXCEPT;
240+ static bool segregated (const input_cptrs& inputs) NOEXCEPT;
241+ static sizes serialized_size (const input_cptrs& inputs,
242+ const output_cptrs& outputs, bool segregated) NOEXCEPT;
243+
244+ void assign_data (reader& source, bool witness) NOEXCEPT;
245+ chain::points points () const NOEXCEPT;
246+
247+ // Signing.
248+ // ------------------------------------------------------------------------
249+
236250 typedef struct
237251 {
238252 hash_digest outputs;
239253 hash_digest points;
240254 hash_digest sequences;
241255 } sighash_cache;
242256
243- static bool segregated (const chain::inputs& inputs) NOEXCEPT;
244- static bool segregated (const input_cptrs& inputs) NOEXCEPT;
245- static sizes serialized_size (const input_cptrs& inputs,
246- const output_cptrs& outputs, bool segregated) NOEXCEPT;
257+ static inline coverage mask_sighash (uint8_t sighash_flags) NOEXCEPT;
258+ static inline bool is_sighash_valid (uint8_t sighash_flags) NOEXCEPT;
247259
248- void assign_data (reader& source, bool witness) NOEXCEPT;
260+ hash_digest outputs_hash () const NOEXCEPT;
261+ hash_digest points_hash () const NOEXCEPT;
262+ hash_digest sequences_hash () const NOEXCEPT;
263+ void initialize_sighash_cache () const NOEXCEPT;
249264
250- // signature hash
251- hash_digest output_hash (const input_iterator& input) const NOEXCEPT;
252265 input_iterator input_at (uint32_t index) const NOEXCEPT;
253266 uint32_t input_index (const input_iterator& input) const NOEXCEPT;
267+ hash_digest output_hash (const input_iterator& input) const NOEXCEPT;
268+
254269 void signature_hash_single (writer& sink, const input_iterator& input,
255270 const script& sub, uint8_t sighash_flags) const NOEXCEPT;
256271 void signature_hash_none (writer& sink, const input_iterator& input,
257272 const script& sub, uint8_t sighash_flags) const NOEXCEPT;
258273 void signature_hash_all (writer& sink, const input_iterator& input,
259274 const script& sub, uint8_t sighash_flags) const NOEXCEPT;
275+
260276 hash_digest unversioned_signature_hash (const input_iterator& input,
261277 const script& sub, uint8_t sighash_flags) const NOEXCEPT;
262278 hash_digest version_0_signature_hash (const input_iterator& input,
263279 const script& sub, uint64_t value, uint8_t sighash_flags,
264280 bool bip143) const NOEXCEPT;
265281
266- // Caching.
267- chain::points points () const NOEXCEPT;
268- hash_digest outputs_hash () const NOEXCEPT;
269- hash_digest points_hash () const NOEXCEPT;
270- hash_digest sequences_hash () const NOEXCEPT;
271- void initialize_sighash_cache () const NOEXCEPT;
272-
273282 // Transaction should be stored as shared (adds 16 bytes).
274283 // copy: 5 * 64 + 2 = 41 bytes (vs. 16 when shared).
275284 uint32_t version_;
0 commit comments