Previously we didn't enforce that delegations sent in the avahello message have at least one delegation level. As a result, when receiving and empty delegation when we don't already have the proof, we could'nt immediately check the avahello signature because we don't know the public key.
This ensure that a node always generates a delegation with a level. The only case in which this didn't already happen was if a user specified an identical -avasessionkey and -avamasterkey. Now in such a case we just add a level which delegates to the same key, which is a perfectly valid delegation.
Empty delegations are still considered valid, and can happen when a node is added via the addavalanchenode, in which case we always have the proof to retrieve the master key from.
This also adds a Delegation::getMaster method, which return the pubkey of the last level of the delegation, and uses it to check the delegation is not empty when receiving an AVAHELLO message.
Functional tests are added to check the node's behavior when receiving an empty delegation or an invalid signature.