Skip to content

Commit b38d0ce

Browse files
Thomas Kerinafk11
authored andcommitted
bitcoinconsensus stubs updated, and target v3.0.0
1 parent b38aa73 commit b38d0ce

File tree

6 files changed

+8
-51
lines changed

6 files changed

+8
-51
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ install:
6565
sudo cp ${HOME}/bitcoin/bitcoin-${BITCOIN_VERSION}/lib/libbitcoinconsensus.so.0.0.0 /usr/lib &&
6666
sudo ln -s /usr/lib/libbitcoinconsensus.so.0.0.0 /usr/lib/libbitcoinconsensus.so &&
6767
sudo ln -s /usr/lib/libbitcoinconsensus.so.0.0.0 /usr/lib/libbitcoinconsensus.so.0 &&
68-
git clone -b v2.0.0 https://github.com/Bit-Wasp/bitcoinconsensus-php &&
68+
git clone -b v3.0.0 https://github.com/Bit-Wasp/bitcoinconsensus-php &&
6969
cd bitcoinconsensus-php/bitcoinconsensus &&
7070
phpize && ./configure --with-bitcoinconsensus &&
7171
make && sudo make install && cd ../..;

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"ext-json": "*",
3838
"phpunit/phpunit": "^5.4.0",
3939
"squizlabs/php_codesniffer": "^2.0.0",
40-
"nbobtc/bitcoind-php": "v2.0.2"
40+
"nbobtc/bitcoind-php": "v2.0.2",
41+
"bitwasp/bitcoinconsensus": "v3.0.0"
4142
}
4243
}

src/Script/Consensus/BitcoinConsensus.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class BitcoinConsensus implements ConsensusInterface
2222
*/
2323
public function verify(TransactionInterface $tx, ScriptInterface $scriptPubKey, int $flags, int $nInputToSign, int $amount): bool
2424
{
25-
if ($flags !== ($flags & BITCOINCONSENSUS_VERIFY_ALL)) {
25+
if ($flags !== ($flags & BITCOINCONSENSUS_SCRIPT_FLAGS_VERIFY_ALL)) {
2626
throw new BitcoinConsensusException("Invalid flags for bitcoinconsensus");
2727
}
2828

stubs/BitcoinConsensusStubs.php

Lines changed: 2 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,4 @@
11
<?php
22

3-
namespace {
4-
define("BITCOINCONSENSUS_VERIFY_NONE", 0);
5-
define("BITCOINCONSENSUS_VERIFY_P2SH", 1 << 0);
6-
define("BITCOINCONSENSUS_VERIFY_STRICTENC", 1 << 1);
7-
define("BITCOINCONSENSUS_VERIFY_DERSIG", 1 << 2);
8-
define("BITCOINCONSENSUS_VERIFY_LOW_S", 1 << 3);
9-
define("BITCOINCONSENSUS_VERIFY_NULLDUMMY", 1 << 4);
10-
define("BITCOINCONSENSUS_VERIFY_SIGPUSHONLY", 1 << 5);
11-
define("BITCOINCONSENSUS_VERIFY_MINIMALDATA", 1 << 6);
12-
define("BITCOINCONSENSUS_VERIFY_DISCOURAGE_UPGRADABLE_NOPS", 1 << 7);
13-
define("BITCOINCONSENSUS_VERIFY_CLEANSTACK", 1 << 8);
14-
define("BITCOINCONSENSUS_VERIFY_CHECKLOCKTIMEVERIFY", 1 << 9);
15-
define("BITCOINCONSENSUS_VERIFY_WITNESS", 1 << 10);
16-
17-
/**
18-
* @return int
19-
*/
20-
function bitcoinconsensus_version() {
21-
}
22-
23-
/**
24-
* @param string $scriptPubKey
25-
* @param int $amount
26-
* @param string $transaction
27-
* @param int $nInput
28-
* @param int $flags
29-
* @param int $error
30-
* @return bool
31-
*/
32-
function bitcoinconsensus_verify_script_with_amount($scriptPubKey, $amount, $transaction, $nInput, $flags, &$error) {
33-
34-
}
35-
36-
/**
37-
* @param string $scriptPubKey
38-
* @param string $transaction
39-
* @param int $nInput
40-
* @param int $flags
41-
* @param int $error
42-
* @return bool
43-
*/
44-
function bitcoinconsensus_verify_script($scriptPubKey, $transaction, $nInput, $flags, &$error) {
45-
46-
}
47-
}
48-
3+
require "../vendor/bitwasp/bitcoinconsensus/stubs/const.php";
4+
require "../vendor/bitwasp/bitcoinconsensus/stubs/functions.php";

tests/Script/BitcoinConsensusTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function testOptionalCheckScriptFlags()
1616
{
1717
if (extension_loaded('bitcoinconsensus')) {
1818
$flags = 1 | 3 | 2 | 65;
19-
$check = $flags == ($flags & BITCOINCONSENSUS_VERIFY_ALL);
19+
$check = $flags == ($flags & BITCOINCONSENSUS_SCRIPT_FLAGS_VERIFY_ALL);
2020
$this->assertFalse($check);
2121

2222
$c = new BitcoinConsensus();

tests/Script/ConsensusTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function prepareConsensusTests()
5454
// versions reject usage of some flags. We skip verification of some
5555
// of these, should be a @todo determine how many of these tests are
5656
// skipped
57-
if ($flags !== ($flags & BITCOINCONSENSUS_VERIFY_ALL)) {
57+
if ($flags !== ($flags & BITCOINCONSENSUS_SCRIPT_FLAGS_VERIFY_ALL)) {
5858
continue;
5959
}
6060
}

0 commit comments

Comments
 (0)