Skip to content

Commit

Permalink
Fix the PeerTest.badMessage() test (#2)
Browse files Browse the repository at this point in the history
* test should fail, not get stuck

* fix packet magic in unittestparams, fix test badMessage
  • Loading branch information
Danconnolly committed Dec 6, 2017
1 parent 8fb98b4 commit c0727da
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion core/src/main/java/org/bitcoinj/params/UnitTestParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class UnitTestParams extends AbstractBitcoinNetParams {
public UnitTestParams() {
super();
id = ID_UNITTESTNET;
packetMagic = 0x0b110907;
packetMagic = 0xf4e5f3f4L; // must be same as testnet3
addressHeader = 111;
p2shHeader = 196;
acceptableAddressCodes = new int[] { addressHeader, p2shHeader };
Expand Down
3 changes: 2 additions & 1 deletion core/src/test/java/org/bitcoinj/core/PeerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@
import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicInteger;

Expand Down Expand Up @@ -956,7 +957,7 @@ public void bitcoinSerializeToStream(OutputStream stream) throws IOException {
}.bitcoinSerialize(), out);
writeTarget.writeTarget.writeBytes(out.toByteArray());
try {
result.get();
result.get(1, TimeUnit.SECONDS);
fail();
} catch (ExecutionException e) {
assertTrue(e.getCause() instanceof ProtocolException);
Expand Down

0 comments on commit c0727da

Please sign in to comment.