Skip to content

Commit af2cd85

Browse files
authored
Merge pull request #22 from twostack/script-size-fix
Script size fix
2 parents 0c8dc23 + 1235ec4 commit af2cd85

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
#Release 1.6.6
2+
### Bug Fixes and small Feature improvement
3+
4+
Fixed script-size bug
5+
- Script-size limit of 10k bytes should only be done for P2SH scripts with STRICTENC flag.
6+
7+
Bug fix - reversed hashes
8+
- placed internal hashes in correct byte order
9+
10+
Blocks & Utilities
11+
- Added ability to construct Transactions from Streams
12+
- Added streaming constructor to VarInt
13+
- Added functionality to Block. It used to be mostly a stub.
14+
- Minor documentation fixes
15+
16+
Additional utilities for number manipulation
17+
18+
Bugfix for fee calculations
19+
- Fee calculation when spending multiple utxos from same transaction
20+
was broken.
21+
122
#Release 1.6.4
223
### Second BugFix for Signature Generation
324

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
}
77

88
group 'org.twostack'
9-
version '1.6.5'
9+
version '1.6.6'
1010

1111
repositories {
1212
mavenCentral()

src/main/java/org/twostack/bitcoin4j/script/Interpreter.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1108,8 +1108,11 @@ public void correctlySpends( Script scriptSig, Script scriptPubKey, Transaction
11081108
} catch (ProtocolException | IOException e) {
11091109
throw new RuntimeException(e); // Should not happen unless we were given a totally broken transaction.
11101110
}
1111-
if (scriptSig.getProgram().length > 10000 || scriptPubKey.getProgram().length > 10000)
1112-
throw new ScriptException(ScriptError.SCRIPT_ERR_SCRIPT_SIZE, "Script larger than 10,000 bytes");
1111+
1112+
if (verifyFlags.contains(VerifyFlag.P2SH) && verifyFlags.contains(VerifyFlag.STRICTENC)) {
1113+
if (scriptSig.getProgram().length > 10000 || scriptPubKey.getProgram().length > 10000)
1114+
throw new ScriptException(ScriptError.SCRIPT_ERR_SCRIPT_SIZE, "Script larger than 10,000 bytes");
1115+
}
11131116

11141117
LinkedList<byte[]> stack = new LinkedList<byte[]>();
11151118
LinkedList<byte[]> p2shStack = null;

0 commit comments

Comments
 (0)