Deduplicate some block-to-JSON code.
Deduplicate some block-to-JSON code.

Some of the logic converting blocks and block headers to JSON for
the blockchain RPC methods (getblock, getlockheader) was duplicated.
Instead of that, the blockToJSON RPC method now calls blockheaderToJSON
first, and then fills in the missing, block-specific bits explicitly.

qtumproject/qtum,sipsorcery/bitcoin,ElementsProject/elements,sipsorcery/bitcoin,jlopp/statoshi,bitcoin/bitcoin,tecnovert/particl-core,andreaskern/bitcoin,instagibbs/bitcoin,pataquets/namecoin-core,Xekyo/bitcoin,MeshCollider/bitcoin,MeshCollider/bitcoin,n1bor/bitcoin,mm-s/bitcoin,achow101/bitcoin,mm-s/bitcoin,Xekyo/bitcoin,ElementsProject/elements,instagibbs/bitcoin,yenliangl/bitcoin,qtumproject/qtum,pataquets/namecoin-core,bitcoin/bitcoin,namecoin/namecoin-core,domob1812/namecore,JeremyRubin/bitcoin,andreaskern/bitcoin,kallewoof/bitcoin,jlopp/statoshi,domob1812/bitcoin,sipsorcery/bitcoin,yenliangl/bitcoin,pataquets/namecoin-core,prusnak/bitcoin,andreaskern/bitcoin,anditto/bitcoin,mm-s/bitcoin,ajtowns/bitcoin,n1bor/bitcoin,domob1812/bitcoin,sstone/bitcoin,JeremyRubin/bitcoin,bitcoin/bitcoin,achow101/bitcoin,apoelstra/bitcoin,bitcoinsSG/bitcoin,yenliangl/bitcoin,AkioNak/bitcoin,namecoin/namecore,achow101/bitcoin,jamesob/bitcoin,apoelstra/bitcoin,pataquets/namecoin-core,MarcoFalke/bitcoin,domob1812/namecore,bitcoinsSG/bitcoin,instagibbs/bitcoin,yenliangl/bitcoin,ajtowns/bitcoin,namecoin/namecore,rnicoll/bitcoin,namecoin/namecoin-core,fanquake/bitcoin,tecnovert/particl-core,sstone/bitcoin,namecoin/namecore,lateminer/bitcoin,lateminer/bitcoin,AkioNak/bitcoin,sstone/bitcoin,rnicoll/bitcoin,bitcoinknots/bitcoin,apoelstra/bitcoin,sstone/bitcoin,jamesob/bitcoin,fujicoin/fujicoin,namecoin/namecore,GroestlCoin/GroestlCoin,AkioNak/bitcoin,fujicoin/fujicoin,particl/particl-core,mruddy/bitcoin,fanquake/bitcoin,JeremyRubin/bitcoin,jamesob/bitcoin,bitcoin/bitcoin,lateminer/bitcoin,MarcoFalke/bitcoin,GroestlCoin/GroestlCoin,lateminer/bitcoin,kallewoof/bitcoin,achow101/bitcoin,fanquake/bitcoin,fanquake/bitcoin,kallewoof/bitcoin,particl/particl-core,apoelstra/bitcoin,dscotese/bitcoin,qtumproject/qtum,andreaskern/bitcoin,particl/particl-core,AkioNak/bitcoin,tecnovert/particl-core,GroestlCoin/GroestlCoin,domob1812/bitcoin,Sjors/bitcoin,namecoin/namecoin-core,sipsorcery/bitcoin,anditto/bitcoin,JeremyRubin/bitcoin,AkioNak/bitcoin,fujicoin/fujicoin,tecnovert/particl-core,domob1812/namecore,GroestlCoin/bitcoin,sstone/bitcoin,MeshCollider/bitcoin,ajtowns/bitcoin,MarcoFalke/bitcoin,GroestlCoin/GroestlCoin,n1bor/bitcoin,particl/particl-core,jlopp/statoshi,anditto/bitcoin,sipsorcery/bitcoin,namecoin/namecoin-core,GroestlCoin/GroestlCoin,dscotese/bitcoin,dscotese/bitcoin,qtumproject/qtum,bitcoin/bitcoin,anditto/bitcoin,kallewoof/bitcoin,Xekyo/bitcoin,tecnovert/particl-core,fanquake/bitcoin,MarcoFalke/bitcoin,bitcoinsSG/bitcoin,Sjors/bitcoin,jambolo/bitcoin,domob1812/bitcoin,GroestlCoin/bitcoin,jambolo/bitcoin,mruddy/bitcoin,particl/particl-core,pataquets/namecoin-core,GroestlCoin/bitcoin,Xekyo/bitcoin,GroestlCoin/bitcoin,instagibbs/bitcoin,bitcoinsSG/bitcoin,n1bor/bitcoin,bitcoinknots/bitcoin,ElementsProject/elements,Xekyo/bitcoin,Sjors/bitcoin,achow101/bitcoin,ajtowns/bitcoin,mm-s/bitcoin,MarcoFalke/bitcoin,apoelstra/bitcoin,ElementsProject/elements,qtumproject/qtum,prusnak/bitcoin,achow101/bitcoin,tecnovert/particl-core,particl/particl-core,apoelstra/bitcoin,MeshCollider/bitcoin,mruddy/bitcoin,domob1812/namecore,jambolo/bitcoin,bitcoinknots/bitcoin,prusnak/bitcoin,lateminer/bitcoin,sipsorcery/bitcoin,JeremyRubin/bitcoin,bitcoinknots/bitcoin,jlopp/statoshi,jambolo/bitcoin,ElementsProject/elements,domob1812/bitcoin,jambolo/bitcoin,kallewoof/bitcoin,bitcoinsSG/bitcoin,prusnak/bitcoin,qtumproject/qtum,dscotese/bitcoin,yenliangl/bitcoin,pataquets/namecoin-core,mruddy/bitcoin,n1bor/bitcoin,andreaskern/bitcoin,namecoin/namecoin-core,domob1812/bitcoin,bitcoinknots/bitcoin,MeshCollider/bitcoin,instagibbs/bitcoin,jlopp/statoshi,domob1812/namecore,namecoin/namecore,AkioNak/bitcoin,Sjors/bitcoin,GroestlCoin/bitcoin,sstone/bitcoin,fanquake/bitcoin,mruddy/bitcoin,rnicoll/bitcoin,jlopp/statoshi,jamesob/bitcoin,dscotese/bitcoin,lateminer/bitcoin,rnicoll/bitcoin,MeshCollider/bitcoin,anditto/bitcoin,prusnak/bitcoin,fujicoin/fujicoin,fujicoin/fujicoin,mruddy/bitcoin,prusnak/bitcoin,rnicoll/bitcoin,namecoin/namecore,ajtowns/bitcoin,JeremyRubin/bitcoin,jamesob/bitcoin,anditto/bitcoin,jamesob/bitcoin,Sjors/bitcoin,instagibbs/bitcoin,jambolo/bitcoin,yenliangl/bitcoin,GroestlCoin/GroestlCoin,mm-s/bitcoin,bitcoinsSG/bitcoin,MarcoFalke/bitcoin,domob1812/namecore,ElementsProject/elements,Xekyo/bitcoin,ajtowns/bitcoin,GroestlCoin/bitcoin,namecoin/namecoin-core,bitcoin/bitcoin,andreaskern/bitcoin,n1bor/bitcoin,dscotese/bitcoin,rnicoll/bitcoin,fujicoin/fujicoin,mm-s/bitcoin,qtumproject/qtum,kallewoof/bitcoin