1 2016-03-17 14:16:42 <stevenroose> question about the head-first mining proposed for Classic: the probabilistic property of mining makes it mostly harmless regarding verification speed, tx throughput, orphan rate...
 2 2016-03-17 14:17:05 <stevenroose> but there is one thing that could influence in a not-very-desirable way: difficulty increases
 3 2016-03-17 14:18:09 <stevenroose> An occasional extra empty block within the 30s after the previous one does no harm at the time it is broadcast, but it will eventually increase the difficulty somewhat
 4 2016-03-17 14:19:14 <stevenroose> Since the main reason for head-first proposal was make mining better for small miners, a difficulty increase is somewhat counter-productive in that regard
 5 2016-03-17 15:23:28 <Chris_Stewart_5> Does anyone know what the equivalent data structure to CScriptNum is inside of python-bitcoinlib?
 6 2016-03-17 15:23:38 <Chris_Stewart_5> link to CScriptNum inside of core: https://github.com/bitcoin/bitcoin/blob/93c85d458ac3e2c496c1a053e1f5925f55e29100/src/script/script.h#L195
 7 2016-03-17 15:28:38 <wumpus> Chris_Stewart_5:   bitcoin.core._bignum.bn2vch / vch2bn
 8 2016-03-17 15:42:22 <Chris_Stewart_5> wumpus: I did the following
 9 2016-03-17 15:42:25 <Chris_Stewart_5> >>> import bitcoin.core._bignum as b
10 2016-03-17 15:42:27 <Chris_Stewart_5> >>> b.bn2vch(0)
11 2016-03-17 15:42:29 <Chris_Stewart_5> ''
12 2016-03-17 15:42:45 <Chris_Stewart_5> is that actually right? ScriptNum should serialize to the empty string?
13 2016-03-17 15:43:12 <Chris_Stewart_5> try to emulate what this would serialize to in hex
14 2016-03-17 15:43:14 <Chris_Stewart_5> https://github.com/bitcoin/bitcoin/blob/605c17844ea32b6d237db6d83871164dc7d59dab/src/test/script_tests.cpp#L65
15 2016-03-17 15:45:31 <wumpus> yes, zero is an empty string
16 2016-03-17 15:45:57 <Chris_Stewart_5> thanks for the clarification
17 2016-03-17 15:46:09 <wumpus> it's a variable length number representation
18 2016-03-17 15:48:24 <Chris_Stewart_5> this? https://en.bitcoin.it/wiki/Protocol_documentation#Variable_length_integer
19 2016-03-17 15:48:48 <wumpus> not that one, a different one
20 2016-03-17 15:49:26 <wumpus> the one you linked is for the serialization format, not the number representation for scripts
21 2016-03-17 15:49:47 <wumpus> scripts are simply byte strings in the serialization format of transactions
22 2016-03-17 17:09:23 <Chris_Stewart_5> So what is the difference between CScript() << CScriptNum(0) << CScriptNum(0) and just an empty CScript() if both of those CScriptNum(0) are being serialized to ''
23 2016-03-17 17:17:45 <wumpus> << CSctriptNum(x) will add a PUSH opcode to the script that pushes X
24 2016-03-17 17:17:51 <gavinandresen> An empty CScript is zero-length. the other is length two (two zero bytes).
25 2016-03-17 17:18:40 <Chris_Stewart_5> gavinandresen: The two zero bytes are push ops as wumpus was saying?
26 2016-03-17 17:20:54 <gavinandresen> yes, push-zero-bytes also known as OP_0 also known as 'the empty string' also known as OP_FALSE ....
27 2016-03-17 17:22:24 <wumpus> yes. So be aware, << for CScript is defined differently than << for normal serialization
28 2016-03-17 17:22:41 <wumpus> this has led many new developers astray
29 2016-03-17 17:23:06 <Chris_Stewart_5> so if the script really looks like CScript(OP_0, ScriptNum(0), OP_0, ScriptNum(0)) which then serializes to "00" + '' + "00" + '' -> "0000"?
30 2016-03-17 17:24:59 <wumpus> the script would look like OP_0 OP_0. No need for any values in between, OP_0 is the operation that pushes a fixed value (the empty string)
31 2016-03-17 17:26:50 <wumpus> there are various classes of push opcodes, << automatically selects the most space-efficient one
32 2016-03-17 17:27:58 <wumpus> which happens to be OP_0 for the empty string, but would be OP_PUSHDATA1 0x4c <0x4c bytes>  for >=0x4c <0x100 bytes
33 2016-03-17 17:28:33 <instagibbs> O, is that why
34 2016-03-17 17:29:03 <Chris_Stewart_5> ok, if this script were to be serialized though for TransactionSignatureSerialization, the OP_0's would be serialized according to this documentation right
35 2016-03-17 17:29:09 <Chris_Stewart_5> https://en.bitcoin.it/wiki/Script#Constants
36 2016-03-17 17:32:01 <Chris_Stewart_5> also I didn't realize you needed the OP_PUSHDATA1 to push the 0x4c onto the stack, wouldn't the interpreter automatically do that? Its been awhile since I looked at code to how these are parsed
37 2016-03-17 17:32:14 <wumpus> Chris_Stewart_5: yes, script numbers are constants
38 2016-03-17 17:32:49 <wumpus> (or at least, are constants if they're pushed into a script literally)
39 2016-03-17 17:48:39 <kanzure> remote code execution vulnerability in git http://seclists.org/oss-sec/2016/q1/645
40 2016-03-17 17:55:24 <wumpus> ugh
41 2016-03-17 18:27:46 <Chris_Stewart_5> is there an easy way to run individual test files inside of bitcoin?
42 2016-03-17 18:27:59 <Chris_Stewart_5> I've tried doign something like this, however I'm not super literate with c++/boost
43 2016-03-17 18:28:01 <Chris_Stewart_5> g++ script_tests.cpp -DSTAND_ALONE -lboost_unit_test_framework -o test1
44 2016-03-17 18:40:09 <wumpus> I don't know about individual tests, but you can certainly run individual test suites
45 2016-03-17 18:41:12 <wumpus> ./test_bitcoin -t script_tests
46 2016-03-17 18:49:53 <wumpus> this works too, you can run one test: ./test_bitcoin -t script_tests/script_IsPushOnly_on_invalid_scripts
47 2016-03-17 18:51:57 <Chris_Stewart_5> sweet, that is exactly what I was looking for.
48 2016-03-17 18:53:15 <Chris_Stewart_5> Does that automatically recompile your test file if you modifed it or does it need to be recompiled manually
49 2016-03-17 18:57:32 <wumpus> no, you still need to run make test_bitcoin
50 2016-03-17 18:57:48 <wumpus> C/C++ executables never automatically recompile themselves
51 2016-03-17 19:02:12 <Chris_Stewart_5> I get an error saying it cannot find chainparamsbase.h, does this need to be run in a specific directory? I tried running it inside of tests/ which appears to have a Makefile with test_bitcoin defined
52 2016-03-17 19:11:59 <wumpus> should just work
53 2016-03-17 19:12:26 <wumpus> just do 'cd src/test; make'