Transcript for #bitcoin-dev 2017/02/09

01:19 bsm117532 My bitcoin node is having trouble with a testnet fork that happened at height 1086627. Does anyone know a good place to find info about forks (especially long ones) that happened on testnet and may be wreaking havoc with my code?
06:46 wumpus I doubt testnet forks are documented anywhere
06:47 wumpus testnet (in contrast to mainnnet) is not usually considered something to watch closely and chronicle about
10:00 TZander bsm117532: did you consider using the regtest network for testing?
10:01 TZander bsm117532: I stopped using testnet a long time ago, its too unpredictable to use for testing.
10:01 TZander unpredictable in a way that isn't realistic, like 1000 block reorgs :)
12:14 RxMcDonald anyone using QT as ide?
12:15 RxMcDonald which is the logger header?
14:05 TZander RxMcDonald: I use QtCreator yes
14:05 TZander logger is util.h
14:06 RxMcDonald TZander: oh, thanks
14:16 RxMcDonald TZander: can you use QT for developing the whole thing or you need another editor for editing the files under /src etc?
14:18 wumpus you can use qt creator for editing the whole thing, an editor is an editor, you'll need to add files to a project specific to that program, probably, and figure out how to set up building
14:19 RxMcDonald Yeah but followed the instructions in the readme and it says it can't find some files, i.e. just left the file selection when importing
14:21 wumpus you should be able to add all the .cpp and .h files
14:24 RxMcDonald wumpus: from the parent directory?
14:25 RxMcDonald files are in the /src folder, and the qt project is inside of it
14:30 RxMcDonald nvm
14:32 RxMcDonald now it says QT can't find boost
14:33 RxMcDonald also including util.h and it can't find Logprintf("...
14:39 RxMcDonald alright fixed that I guess
15:28 TZander RxMcDonald: I have a perl script that generates a couple of .pro files which I then open in the project.
15:29 TZander The only thing I need to do manually is remove their 'run qmake' line in the build settings. Which you only have to do once on opening.
15:29 TZander so, yeah, I edit and use auto complete and all that goodness. Compile and run it in a debugger. All from within the app.
16:01 RxMcDonald nice TZander, that's what I'm loooking for, I'm going to keep at it later when I get home
17:02 sanket1729 Hey!
17:02 sanket1729 Would this be the place where I can discuss non-formulated rough ideas?
17:12 bsm117532 TZander: can't really test with regtest when multiple clients are involved...
19:45 TZander bsm117532: why not? Did you manage to connect them to each other?
19:46 bsm117532 Honestly I never have figured out regtest mode. You can connect multiple regtest instances?
19:47 arubi this is how bitcoin tests are done :)
19:47 TZander sure, regtest is the same software, just using a different set of parameters so you can mine with practically no difficulty.
19:47 arubi well, maybe not with it being python, but very similar I guess
19:48 TZander essentially you pass a set of paramters to each instance. Each is given a unique port number to listen on and you can then connect them.
19:49 arubi bsm117532, you can set them at IPs 127.10.0.{1..10}, each to his own ip, that way you don't have to mess with ports and such
19:49 arubi keep a .conf file for each node, set 'uacomment=reg{1..10}' for each, and bind to an IP in the range
19:50 bsm117532 Hmmm... I might just have to do that. I'm concerned about testnet reorgs during our beta test. And unfortunately I can't run on mainnet because I need segwit...
19:50 arubi call bitcoind\-cli with the different .confs, you can alias reg{1..10}-cli to say reg1-cli -conf=$HOME/.bitcoin/reg1.conf
19:50 TZander bsm117532:
19:51 arubi protip: set datadirs to /dev/shm/..., ultra fast regtest stuff
19:55 bsm117532 there any problem with having a long-running regtest network? (up to months...)
19:55 arubi no :)
19:56 bsm117532 Hmmmm....hhhhmmmmm....
19:56 bsm117532 TZander, arubi thanks guys
19:57 arubi cheers, just a small detail, blocks 751 and onwards activate new rules, so before that you have "old bitcoin"
19:57 arubi (things might be activated at different blocks before though, not sure)
19:59 bsm117532 Yeah I need to figure out which soft forks have been deployed. Obviously I need the regtest to have SPV activated...
19:59 bsm117532 err...segwit rather.
19:59 arubi that's 751 last time I actually checked
19:59 bsm117532 Ok, will investigate...
20:00 arubi right now I have an init script that mines 751, then sends 100 to a second node for "stuff"
20:00 arubi so I don't have a ton of outputs on a work node. block halving is very quick, I think every 50 blocks so by the time you mined 751 you have most of it :)
20:01 arubi er, reward halving.
20:25 bsm117532 How can I get regtest mode to simulate mining over time, instead of immediately generating blocks?
20:26 achow101 bsm117532: write a script that just loops through sleep ten minutes and then mine a block
20:26 bsm117532 That was my first idea...that' really the best way to do it?
20:27 achow101 I don't think you can configure core to change the difficulty for regtest, so I think that's the best way to do it
20:28 achow101 you could change the regtest difficulty but you would have to change the source and compile
20:28 bsm117532 Well it's wasteful to make it *actually* mine...doing it on a timer would be better...
20:28 arubi generate sha256 from /dev/urandom and only 'generate 1' when diff is good :)
20:28 arubi s/target
20:28 arubi ah well
20:30 arubi why does the timing matter though? blocks could also be seconds apart. maybe you could set 'blocknotify='regtest-cli generate 1' for perfect timing :)
20:30 arubi set it on a mainnet node that is
20:32 bsm117532 And now we're going to exercise whether my frankenstien of python-bitcoinlib, bcoin, and bitcoin core can all talk to each other in regtest mode...
20:37 bsm117532 arubi: that's hilarious. Also I just might do that... blocknotify='sleep 600; bitcoin-cli -regtest generate 1'
20:38 arubi 'blocknotify='sleep $(possion); bitcoin-cli -regtest generate 1' :)
20:41 bsm117532 what's $(poisson)? Also it's a geometric distribution, not poisson IIRC...
20:44 arubi guess so, I guess it's just the number of the blocks mined in a duration, not the actual time between them if you wanna "wait it out". $(possion) is just a mock function to return the time to sleep :)
21:15 bsm117532 I was just wondering if you had such a function...written in bash... :-P
21:22 arubi haha, unfortunately not that one. I have a mainnet node so if I wanted 1:1 timing I'd set 'blocknotify="regtest-cli generate 1" in my mainnet.conf, and if I really wanted to control the timing I'd try to interface with SetMockTime() from util.h :)
21:24 arubi probably only moderately difficult to trace the 'genrate #' call and change 'curtime' to something else
21:26 arubi ah it's called utiltime.h now