Do not access ScriptBuf inner from builder

The `Builder` is staying in `bitcoin` while the `ScriptBuf` is moving to
`primitives`, so we cannot access the inner field of `ScriptBuf`.

Use the new `as_byte_vec` hack to mutate the inner `ScriptBuf` field.
This commit is contained in:
Tobin C. Harding 2024-08-21 11:33:17 +10:00
parent 900af453ff
commit 95f2a8dab6
No known key found for this signature in database
GPG Key ID: 40BF9E4C269D6607
1 changed files with 2 additions and 2 deletions

View File

@ -7,7 +7,7 @@ use crate::locktime::absolute;
use crate::opcodes::all::*;
use crate::opcodes::{self, Opcode};
use crate::prelude::Vec;
use crate::script::{ScriptBufExt as _, ScriptExtPriv as _};
use crate::script::{ScriptBufExt as _, ScriptBufExtPriv as _, ScriptExtPriv as _};
use crate::Sequence;
/// An Object which can be used to construct a script piece by piece.
@ -82,7 +82,7 @@ impl Builder {
// "duplicated code" because we need to update `1` field
match opcode_to_verify(self.1) {
Some(opcode) => {
(self.0).0.pop();
(self.0).as_byte_vec().pop();
self.push_opcode(opcode)
}
None => self.push_opcode(OP_VERIFY),