GitHub PushEvent at 2014-01-17 02:03:23
Repository: btcchain
Actor: conformal-deploy
Payload: {"shas":[["84f6089bc911ada900537040b49eb7a3684ec2a8","40f085f3e2c05dc127b0a330228985d077d6c8f7@conformal.com","Rework and improve async script validation logic.\n\nThe previous script validation logic entailed starting up a hard-coded\nnumber of goroutines to process the transaction scripts in parallel.  In\nparticular, one goroutine (up to 8 max) was started per transaction in a\nblock and another one was started for each input script pair in the\neach transaction.  This resulted in 64 goroutines simultaneously running\nscripts and verifying cryptographic signatures.  This could easily lead to\nthe overall system feeling sluggish.\n\nFurther the previous design could also result in bursty behavior since the\nnumber of inputs to a transaction as well as its complexity can vary\nwidely between transactions.  For example, starting 2 goroutines (one to\nprocess the transaction and one for actual script pair validation) to\nverify a transaction with a single input was not desirable.\n\nFinally, the previous design validated all transactions and inputs\nregardless of a failure in one of the other scripts.  This really didn't\nhave a big impact since it's quite rare that blocks with invalid\nverifications are being processed, but it was a potential way DoS vector.\n\nThis commit changes the logic in a few ways to improve things:\n\n- The max number of validation goroutines is now based on the number of\n  cores in the system\n- All transaction inputs from all transactions in the block are collated\n  into a single list which is fed through the aforementioned validation\n  goroutines\n- The validation CPU usage is much more consistent due to the collation of\n  inputs\n- A validation error in any goroutine immediately stops validation of all\n  remaining inputs\n- The errors have been improved to include context about what tx script\n  pair failed as opposed to showing the information as a warning\n\nThis closes conformal/btcd#59.","Dave Collins",true]],"size":1,"ref":"refs/heads/master","head":"84f6089bc911ada900537040b49eb7a3684ec2a8"}