[bitshares/bitshares-core] Fix issue #125: sign block with old key if signing key updated in same block (#1203)

pmconrad commented on this pull request.

> @@ -250,7 +253,7 @@ block_production_condition::block_production_condition_enum witness_plugin::mayb
}

fc::time_point_sec scheduled_time = db.get_slot_time( slot );
— graphene::chain::public_key_type scheduled_key = scheduled_witness( db ).signing_key;
+ graphene::chain::public_key_type scheduled_key = *db.find_witness_key_from_cache( scheduled_witness ); // should be valid

The witness plugin *typically* needs to keep track of the keys of only one witness. Refreshing this after each pushed block should have minimal cost, and only for the node in question.